Skip to content

Commit

Permalink
Handle case where 'extendee' is undefined.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo Du committed Sep 15, 2017
1 parent 952c7d1 commit 7dec43d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ext/descriptor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7dec43d

Please sign in to comment.