fix: add safeguard for undefined

closes #236
This commit is contained in:
Roman Hotsiy 2017-03-29 13:30:48 +03:00
parent 6aa3a7d863
commit aaac434ebb
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -189,7 +189,7 @@ export class SpecManager {
// check if parent definition name is in the enum of possible values
if (definition.discriminator) {
let prop = definition.properties[definition.discriminator];
if (prop.enum && prop.enum.indexOf(JsonPointer.baseName(defPointer)) > -1) {
if (prop && prop.enum && prop.enum.indexOf(JsonPointer.baseName(defPointer)) > -1) {
res.push({
name: JsonPointer.baseName(defPointer),
$ref: defPointer