From 84506ffd3e4032b071856ca875894f770b4d2687 Mon Sep 17 00:00:00 2001 From: "jkeiser%iname.com" Date: Wed, 28 Nov 2001 03:22:30 +0000 Subject: [PATCH] Fix for bug 109754 (crash on dhtmlcentral.com). r=kin@netscape.com, sr=jst@netscape.com --- editor/libeditor/text/nsPlaintextEditor.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/editor/libeditor/text/nsPlaintextEditor.cpp b/editor/libeditor/text/nsPlaintextEditor.cpp index e5f423b7d7b2..5c7a0134c268 100644 --- a/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/editor/libeditor/text/nsPlaintextEditor.cpp @@ -1217,6 +1217,8 @@ nsPlaintextEditor::GetWrapWidth(PRInt32 *aWrapColumn) nsCOMPtr styleContext; res = GetBodyStyleContext(getter_AddRefs(styleContext)); if (NS_FAILED(res)) return res; + NS_ASSERTION(styleContext, "styleContext is null!"); + if (!styleContext) return NS_ERROR_FAILURE; const nsStyleText* styleText = (const nsStyleText*)styleContext->GetStyleData(eStyleStruct_Text); @@ -1232,15 +1234,9 @@ nsPlaintextEditor::GetWrapWidth(PRInt32 *aWrapColumn) if (stylePosition->mWidth.GetUnit() == eStyleUnit_Chars) *aWrapColumn = stylePosition->mWidth.GetIntValue(); else - { - *aWrapColumn = -1; return NS_ERROR_UNEXPECTED; - } - } - else - { - *aWrapColumn = -1; } + return NS_OK; }