Skip to content

Commit 1431c61

Browse files
committed
fix(alerts): check for null description before performing find and replace
1 parent 1ea965b commit 1431c61

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/alerts/reducers/alerts.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ const alerts = (state = defaultState, action) => {
100100
const alert = {
101101
id: rtdAlert.Id,
102102
title: rtdAlert.HeaderText,
103-
description: rtdAlert.DescriptionText.replace(/(\r\n)/g, '\n'), // RTD server sends back two-char new lines, which can mess up character limit counts
103+
// RTD server sends back two-char new lines, which can mess up character limit counts
104+
// Here, we replace any of those occurrences with a single new line char.
105+
description: rtdAlert.DescriptionText && rtdAlert.DescriptionText.replace(/(\r\n)/g, '\n'),
104106
cause: rtdAlert.Cause,
105107
effect: rtdAlert.Effect,
106108
editedBy: rtdAlert.EditedBy,

0 commit comments

Comments
 (0)