Skip to content

Commit

Permalink
return base if it's null without let nextBase
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka committed May 28, 2021
1 parent 40aa593 commit e182461
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/helpers/get-property-in-chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ export function getPropertyInChain(base, chain) {
const prop = chain.slice(0, pos);

// https://github.com/AdguardTeam/Scriptlets/issues/128
let nextBase = null;
if (base === null) {
// if base is null, return 'null' as base.
// it's needed for triggering the reason logging while debugging
return { base: nextBase, prop, chain };
return { base, prop, chain };
}

nextBase = base[prop];
const nextBase = base[prop];
chain = chain.slice(pos + 1);
if (nextBase !== undefined) {
return getPropertyInChain(nextBase, chain);
Expand Down

0 comments on commit e182461

Please sign in to comment.