Skip to content

Commit 13b9c82

Browse files
author
Eric Koleda
authored
Handle the case where there are no template vars.
1 parent e1f487c commit 13b9c82

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gmail/mailmerge/mailmerge.gs

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ function fillInTemplateFromObject(template, data) {
196196

197197
// Replace variables from the template with the actual values from the data object.
198198
// If no value is available, replace with the empty string.
199-
for (var i = 0; i < templateVars.length; ++i) {
199+
for (var i = 0; templateVars && i < templateVars.length; ++i) {
200200
// normalizeHeader ignores ${"} so we can call it directly here.
201201
// [START apps_script_gmail_template_variable_data]
202202
var variableData = data[normalizeHeader(templateVars[i])];

0 commit comments

Comments
 (0)