From: Ariel Flesler Date: Thu, 25 Dec 2008 21:20:41 +0000 (+0000) Subject: jquery core: Closes #3737. Fixed a possible null dereference. X-Git-Tag: 1.3b2~52 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8cd50a398dfd9ab8ad93c7c26749c67345c14d74;p=jquery.git jquery core: Closes #3737. Fixed a possible null dereference. --- diff --git a/src/core.js b/src/core.js index 5a098bebd..b8b207b71 100644 --- a/src/core.js +++ b/src/core.js @@ -1016,12 +1016,14 @@ jQuery.extend({ if ( fragment ) { for ( var i = 0; ret[i]; i++ ) { - if ( jQuery.nodeName( ret[i], "script" ) ) { - ret[i].parentNode.removeChild( ret[i] ); + elem = ret[i]; + if ( jQuery.nodeName( elem, "script" ) ) { + if( elem.parentNode ) + elem.parentNode.removeChild( elem ); } else { - if ( ret[i].nodeType === 1 ) - ret = jQuery.merge( ret, ret[i].getElementsByTagName("script")); - fragment.appendChild( ret[i] ); + if ( elem.nodeType === 1 ) + ret = jQuery.merge( ret, elem.getElementsByTagName("script")); + fragment.appendChild( elem ); } }