summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2016-10-01 21:22:20 +0000
committerGreg Ercolano <erco@seriss.com>2016-10-01 21:22:20 +0000
commita82eed18e5a9d0984d607127bddc95f5f8690803 (patch)
tree91f0baab8d00a465d3aa4fc755941c4e1db4d7a8
parent7e273a9fd3f87f6456822c4d7263ac9934429f5c (diff)
Bringing over fix [r12000] from 1.3 current to the porting branch.
Applying my suggested patch to solve immediate issues with STR #3231. Probably more needs to be done (see STR), but at least solves the immediate issues. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12001 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_Text_Display.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx
index 4d2b8bdd8..e3a2b8947 100644
--- a/src/Fl_Text_Display.cxx
+++ b/src/Fl_Text_Display.cxx
@@ -1027,7 +1027,9 @@ int Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) const {
int lineStartPos, fontHeight;
int visLineNum;
/* If position is not displayed, return false */
- if (pos < mFirstChar || (pos > mLastChar && !empty_vlines())) {
+ if ((pos < mFirstChar) ||
+ (pos > mLastChar && !empty_vlines()) ||
+ (pos > buffer()->length()) ) { // STR #3231
return (*X=*Y=0); // make sure X & Y are set when it is out of view
}