Skip to content

Commit

Permalink
fix(prop-filler): obj may have null prototype (#399)
Browse files Browse the repository at this point in the history
* fix(prop-filler): obj may have null prototype

* fix(prop-filler): missing return value
  • Loading branch information
redgeoff authored Jun 4, 2021
1 parent 5450e16 commit 65c09c9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/compiler/prop-filler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 65c09c9

Please sign in to comment.