diff --git a/ext/descriptor/index.js b/ext/descriptor/index.js index 6aafd2ab8..facef58ab 100644 --- a/ext/descriptor/index.js +++ b/ext/descriptor/index.js @@ -485,7 +485,7 @@ Field.prototype.toDescriptor = function toDescriptor(syntax) { // Handle part of oneof if (this.partOf) - if ((descriptor.oneofIndex = this.parent.oneofsArray.indexOf(this.partOf)) < 0) + if (this.parent.oneofsArray && (descriptor.oneofIndex = this.parent.oneofsArray.indexOf(this.partOf)) < 0) throw Error("missing oneof"); if (this.options) {