Fix crash in support code when there are no annotations

This commit is contained in:
Patrick Niklaus 2017-03-13 22:24:34 +00:00 committed by Patrick Niklaus
parent 2cc22ce098
commit 23c74af2b5

View File

@ -152,9 +152,9 @@ module.exports = function () {
let a_type = k.slice(2);
if (whitelist.indexOf(a_type) == -1)
return cb(new Error('Unrecognized annotation field', a_type));
if (!annotation[a_type])
if (annotation && !annotation[a_type])
return cb(new Error('Annotation not found in response', a_type));
got[k] = annotation[a_type];
got[k] = annotation && annotation[a_type] || '';
}
});