Check for descriptor

This commit is contained in:
Gregg Van Hove
2015-10-26 17:03:45 -07:00
parent 0b1e1a0401
commit a85c3a4da8
2 changed files with 2 additions and 2 deletions

View File

@@ -1993,7 +1993,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
}
var descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
if (!(descriptor.writable || descriptor.set)) {
if (descriptor && !(descriptor.writable || descriptor.set)) {
throw new Error(methodName + ' is not declared writable or has no setter');
}

View File

@@ -23,7 +23,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
}
var descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
if (!(descriptor.writable || descriptor.set)) {
if (descriptor && !(descriptor.writable || descriptor.set)) {
throw new Error(methodName + ' is not declared writable or has no setter');
}