diff --git a/lib/import.js b/lib/import.js index 675e5f60..72e606d4 100644 --- a/lib/import.js +++ b/lib/import.js @@ -78,7 +78,9 @@ function getDescendantProp(obj, desc, defaultvalue) { const arr = desc.split('.'); while (arr.length) { const nextKey = arr.shift(); - if (nextKey.includes('[')) { + if (obj == null) { + return defaultvalue; + } else if (nextKey.includes('[')) { const arrayKey = nextKey.match(/(\w*)\[(\d+)\]/); if (obj[arrayKey[1]] === undefined) { return defaultvalue;