From 65c09c99c384de1bbd22f9fd3bad490633176393 Mon Sep 17 00:00:00 2001 From: Geoff Cox Date: Thu, 3 Jun 2021 23:30:15 -0700 Subject: [PATCH] fix(prop-filler): obj may have null prototype (#399) * fix(prop-filler): obj may have null prototype * fix(prop-filler): missing return value --- src/compiler/prop-filler.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/prop-filler.js b/src/compiler/prop-filler.js index a73db107..fb1ebaaa 100644 --- a/src/compiler/prop-filler.js +++ b/src/compiler/prop-filler.js @@ -34,7 +34,10 @@ export default class PropFiller { hasProperty = true; } else { nestedObj = obj[names[0]]; - hasProperty = obj.hasOwnProperty(names[0]); + + // We cannot just use `obj.hasOwnProperty()` here as obj may have a null prototype, e.g. + // `obj = Object.create(null)` + hasProperty = Object.prototype.hasOwnProperty.call(obj, names[0]); } if (names.length > 1) {