Navigation Menu

Skip to content

Commit

Permalink
ensure object exists before accessing .get
Browse files Browse the repository at this point in the history
  • Loading branch information
EugenMayer committed Nov 20, 2013
1 parent edcfd7f commit 7bad486
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions xccessors-legacy.js
Expand Up @@ -57,15 +57,15 @@
defineProp(this, prop, { set: fun });
});
}
if (getProp) {
extendMethod(methods[2], function (prop) { // __lookupGetter__
return getProp(this, prop).get ||
getProp(this.constructor[proto], prop).get; // look in prototype too
});
extendMethod(methods[3], function (prop) { // __lookupSetter__
return getProp(this, prop).set ||
getProp(this.constructor[proto], prop).set; // look in prototype too
});
}

if (getProp) {
extendMethod(methods[2], function (prop) { // __lookupGetter__
return ( (getProp(this, prop) && getProp(this, prop).get) ||
(getProp(this.constructor[proto], prop) && getProp(this.constructor[proto], prop).get )); // look in prototype too
});
extendMethod(methods[3], function (prop) { // __lookupSetter__
return ( (getProp(this, prop) && getProp(this, prop).set) ||
(getProp(this.constructor[proto], prop) && getProp(this.constructor[proto], prop).set )); // look in prototype too
});
}
}());

0 comments on commit 7bad486

Please sign in to comment.