Merge pull request #2212 from joedf/regression-fix-2201

Undefined check for object descriptor
This commit is contained in:
Ian Gilman 2022-10-24 14:16:21 -07:00 committed by GitHub
commit af564547f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1102,13 +1102,19 @@ function OpenSeadragon( options ){
// Extend the base object // Extend the base object
for ( name in options ) { for ( name in options ) {
var descriptor = Object.getOwnPropertyDescriptor(options, name); var descriptor = Object.getOwnPropertyDescriptor(options, name);
if (descriptor.get || descriptor.set) {
Object.defineProperty(target, name, descriptor); if (descriptor !== undefined) {
if (descriptor.get || descriptor.set) {
Object.defineProperty(target, name, descriptor);
continue;
}
copy = descriptor.value;
} else {
$.console.warn('Could not copy inherited property "' + name + '".');
continue; continue;
} }
copy = descriptor.value;
// Prevent never-ending loop // Prevent never-ending loop
if ( target === copy ) { if ( target === copy ) {
continue; continue;