Skip to content

Commit 4d9ea56

Browse files
committed
handle null and undefined values
1 parent eb7bce7 commit 4d9ea56

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/helpers/mail/mail.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,13 @@ function Personalization() {
623623
this.substitutions = {};
624624
}
625625
var currentKey = Object.keys(substitution)[0];
626-
this.substitutions[currentKey] = substitution[currentKey].toString();
626+
var currentVal = substitution[currentKey];
627+
if (currentVal === null || typeof currentVal === 'undefined') {
628+
this.substitutions[currentKey] = '';
629+
}
630+
else {
631+
this.substitutions[currentKey] = currentVal.toString();
632+
}
627633
};
628634

629635
this.getSubstitutions = function() {

0 commit comments

Comments
 (0)