From 20833aaa0a5e6327596eda231bdf835754bb3be7 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Mon, 4 Sep 2006 19:57:23 +0000 Subject: [PATCH] Prevents crashes caused by negative line count being passed to wrapping functions, e.g. in intermediate sizing states. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/src/stc/scintilla/src/Editor.cxx | 5 ++++- src/stc/scintilla/src/Editor.cxx | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/contrib/src/stc/scintilla/src/Editor.cxx b/contrib/src/stc/scintilla/src/Editor.cxx index 87a0391b48..a69194f97e 100644 --- a/contrib/src/stc/scintilla/src/Editor.cxx +++ b/contrib/src/stc/scintilla/src/Editor.cxx @@ -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() { diff --git a/src/stc/scintilla/src/Editor.cxx b/src/stc/scintilla/src/Editor.cxx index 87a0391b48..a69194f97e 100644 --- a/src/stc/scintilla/src/Editor.cxx +++ b/src/stc/scintilla/src/Editor.cxx @@ -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() { -- 2.45.2