summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
}