Jacek Caban : mshtml: Don't crash in set_font_size if range_cnt is 0.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jun 12 06:30:44 CDT 2007


Module: wine
Branch: master
Commit: 068ce61523e74f0c1e9540ace5148af7ff97def4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=068ce61523e74f0c1e9540ace5148af7ff97def4

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Jun 11 17:31:12 2007 +0200

mshtml: Don't crash in set_font_size if range_cnt is 0.

---

 dlls/mshtml/editor.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c
index d257c5f..b727e55 100644
--- a/dlls/mshtml/editor.c
+++ b/dlls/mshtml/editor.c
@@ -364,6 +364,15 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size)
     if(!nsselection)
         return;
 
+    nsISelection_GetRangeCount(nsselection, &range_cnt);
+    if(range_cnt != 1) {
+        FIXME("range_cnt %d not supprted\n", range_cnt);
+        if(!range_cnt) {
+            nsISelection_Release(nsselection);
+            return;
+        }
+    }
+
     nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
     if(NS_FAILED(nsres))
         return;
@@ -372,10 +381,6 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size)
     nsAString_Init(&size_str, wszSize);
     nsAString_Init(&val_str, size);
 
-    nsISelection_GetRangeCount(nsselection, &range_cnt);
-    if(range_cnt != 1)
-        FIXME("range_cnt %d not supprted\n", range_cnt);
-
     nsIDOMDocument_CreateElement(nsdoc, &font_str, &elem);
     nsIDOMElement_SetAttribute(elem, &size_str, &val_str);
 




More information about the wine-cvs mailing list