Skip to content

Commit 0b953f5

Browse files
committed
index: guard mutation result auto-insert-id
1 parent e20311c commit 0b953f5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/datastore/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ Transaction.prototype.saveAll = function(keys, objs, callback) {
195195
if (err || !resp) {
196196
return callback(err);
197197
}
198-
var keys = [], i = 0;
199-
resp.mutationResult.insertAutoIdKeys.forEach(function(item) {
200-
keys[i++] = entity.keyFromKeyProto(item);
198+
var keys = [];
199+
resp.mutationResult.insertAutoIdKeys && resp.mutationResult.insertAutoIdKeys.forEach(function(item) {
200+
keys.push(entity.keyFromKeyProto(item));
201201
});
202202
callback(null, keys);
203203
});

0 commit comments

Comments
 (0)