]> git.saurik.com Git - wxWidgets.git/commitdiff
Prevents crashes caused by negative line count being passed to wrapping functions...
authorJulian Smart <julian@anthemion.co.uk>
Mon, 4 Sep 2006 19:57:23 +0000 (19:57 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Mon, 4 Sep 2006 19:57:23 +0000 (19:57 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

contrib/src/stc/scintilla/src/Editor.cxx
src/stc/scintilla/src/Editor.cxx

index 87a0391b487ff2a951052f0871aa8868adf9e7aa..a69194f97e854344f8a2c507dcd0cff4ed76960f 100644 (file)
@@ -519,7 +519,10 @@ int Editor::LinesOnScreen() {
        PRectangle rcClient = GetClientRectangle();
        int htClient = rcClient.bottom - rcClient.top;
        //Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1);
-       return htClient / vs.lineHeight;
+       int n = htClient / vs.lineHeight;
+        if (n < 0)
+            n = 0;
+        return n;
 }
 
 int Editor::LinesToScroll() {
index 87a0391b487ff2a951052f0871aa8868adf9e7aa..a69194f97e854344f8a2c507dcd0cff4ed76960f 100644 (file)
@@ -519,7 +519,10 @@ int Editor::LinesOnScreen() {
        PRectangle rcClient = GetClientRectangle();
        int htClient = rcClient.bottom - rcClient.top;
        //Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1);
-       return htClient / vs.lineHeight;
+       int n = htClient / vs.lineHeight;
+        if (n < 0)
+            n = 0;
+        return n;
 }
 
 int Editor::LinesToScroll() {