From afd6b8cd47839d4addbc847ac60e33112218869d Mon Sep 17 00:00:00 2001 From: "jst%netscape.com" Date: Wed, 17 May 2000 04:01:57 +0000 Subject: [PATCH] Fix bug 33111, crash when creating an applet element from JS, now we no longer crash but dynamically creating applets doesn't work yet. git-svn-id: svn://10.0.0.236/trunk@70267 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/content/src/nsHTMLAppletElement.cpp | 16 ++++++++++------ .../html/content/src/nsHTMLAppletElement.cpp | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/mozilla/content/html/content/src/nsHTMLAppletElement.cpp b/mozilla/content/html/content/src/nsHTMLAppletElement.cpp index 7fb2b9fb2e7..a5509030440 100644 --- a/mozilla/content/html/content/src/nsHTMLAppletElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAppletElement.cpp @@ -320,12 +320,16 @@ if (NS_SUCCEEDED(rv)) { return rv; // 2. get the plugin instance corresponding to this element. - nsIPresShell* shell = mInner.mDocument->GetShellAt(0); - if (nsnull == shell) - return NS_ERROR_FAILURE; - nsIFrame* frame = nsnull; - shell->GetPrimaryFrameFor(mInner.mContent, &frame); - NS_RELEASE(shell); + nsIPresShell* shell = nsnull; + if (mInner.mDocument) + shell = mInner.mDocument->GetShellAt(0); + + nsIFrame* frame = nsnull; + + if (shell) { + shell->GetPrimaryFrameFor(mInner.mContent, &frame); + NS_RELEASE(shell); + } if(frame != nsnull) { diff --git a/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp b/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp index 7fb2b9fb2e7..a5509030440 100644 --- a/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp @@ -320,12 +320,16 @@ if (NS_SUCCEEDED(rv)) { return rv; // 2. get the plugin instance corresponding to this element. - nsIPresShell* shell = mInner.mDocument->GetShellAt(0); - if (nsnull == shell) - return NS_ERROR_FAILURE; - nsIFrame* frame = nsnull; - shell->GetPrimaryFrameFor(mInner.mContent, &frame); - NS_RELEASE(shell); + nsIPresShell* shell = nsnull; + if (mInner.mDocument) + shell = mInner.mDocument->GetShellAt(0); + + nsIFrame* frame = nsnull; + + if (shell) { + shell->GetPrimaryFrameFor(mInner.mContent, &frame); + NS_RELEASE(shell); + } if(frame != nsnull) {