From 7dec43d9d847481ad93fca498fd970b3a4a14b11 Mon Sep 17 00:00:00 2001 From: Bo Du Date: Fri, 15 Sep 2017 00:10:25 -0400 Subject: [PATCH] Handle case where 'extendee' is undefined. --- ext/descriptor/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/descriptor/index.js b/ext/descriptor/index.js index b33db3b98..6f230caaa 100644 --- a/ext/descriptor/index.js +++ b/ext/descriptor/index.js @@ -400,12 +400,16 @@ Field.fromDescriptor = function fromDescriptor(descriptor, syntax) { default: throw Error("illegal label: " + descriptor.label); } + var extendee = descriptor.extendee; + if (descriptor.extendee !== undefined) { + extendee = extendee.length ? extendee : undefined; + } var field = new Field( descriptor.name.length ? descriptor.name : "field" + descriptor.number, descriptor.number, fieldType, fieldRule, - descriptor.extendee.length ? descriptor.extendee : undefined + extendee ); field.options = fromDescriptorOptions(descriptor.options, exports.FieldOptions);