Reviewed by Ken.
authorkdecker <kdecker@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Jan 2005 18:40:48 +0000 (18:40 +0000)
committerkdecker <kdecker@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Jan 2005 18:40:48 +0000 (18:40 +0000)
Fixed: <rdar://problem/3924219> Calling setOuterHTML: on a DOMHTMLHtmlElement can crash a program

        * khtml/html/html_elementimpl.cpp:
        (HTMLElementImpl::setOuterHTML): Added a nil check for fragments who don't have parents.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8324 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/html/html_elementimpl.cpp

index ecc2824ea4e7a1658d74db6b109d94353edd5909..56d1fa073a172f47c65bb25e990277239cdd5845 100644 (file)
@@ -1,3 +1,12 @@
+2005-01-08  Kevin Decker  <kdecker@apple.com>
+
+        Reviewed by Ken.
+
+       Fixed: <rdar://problem/3924219> Calling setOuterHTML: on a DOMHTMLHtmlElement can crash a program
+
+        * khtml/html/html_elementimpl.cpp:
+        (HTMLElementImpl::setOuterHTML): Added a nil check for fragments who don't have parents.
+
 2005-01-07  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Darin.
index ab0ca2c40d9c023e8fb1f89e2ac664f45268ec1d..8cfbde1b1f66a2aeb582860430e5c59133fc7fde 100644 (file)
@@ -823,7 +823,11 @@ bool HTMLElementImpl::setOuterHTML( const DOMString &html )
     }
     
     int ec = 0;
-    parentNode()->replaceChild(fragment, this, ec);
+    
+    if (parentNode()) {
+        parentNode()->replaceChild(fragment, this, ec);
+    }
+    
     return !ec;
 }