diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-09-26 20:27:16 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-09-26 20:27:16 +0000 |
| commit | 0c0035904c10acb85a66fe17532dfa844120e72c (patch) | |
| tree | 34302e6ee73e3f0e56adf86ae0c2ed9983f9bd39 /src/Fl_Text_Display.cxx | |
| parent | a1b7e13ba9f1fd26b813c9050ff48af7d5831cf7 (diff) | |
Fix bug #613088 - Fl_Text_Display crash.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2638 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Text_Display.cxx')
| -rw-r--r-- | src/Fl_Text_Display.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 1a96582a8..5a3b73b91 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Text_Display.cxx,v 1.12.2.28 2002/09/20 19:59:45 easysw Exp $" +// "$Id: Fl_Text_Display.cxx,v 1.12.2.29 2002/09/26 20:27:16 easysw Exp $" // // Copyright 2001-2002 by Bill Spitzak and others. // Original code Copyright Mark Edel. Permission to distribute under @@ -742,6 +742,7 @@ int Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) { /* Calculate Y coordinate */ if (!position_to_line(pos, &visLineNum)) return 0; + if (visLineNum < 0 || visLineNum >= nNBufferLines) return 0; fontHeight = mMaxsize; *Y = text_area.y + visLineNum * fontHeight; @@ -1332,8 +1333,8 @@ void Fl_Text_Display::reset_absolute_top_line_number() { int Fl_Text_Display::position_to_line( int pos, int *lineNum ) { int i; - if ( pos < mFirstChar ) - return 0; + *lineNum = 0; + if ( pos < mFirstChar ) return 0; if ( pos > mLastChar ) { if ( empty_vlines() ) { if ( mLastChar < mBuffer->length() ) { @@ -3007,5 +3008,5 @@ int Fl_Text_Display::handle(int event) { // -// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.28 2002/09/20 19:59:45 easysw Exp $". +// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.29 2002/09/26 20:27:16 easysw Exp $". // |
