Browse Source

fix error when mouse event fires on text field withour current renderer

Kolja Strohm 3 years ago
parent
commit
c745d98f84
1 changed files with 3 additions and 1 deletions
  1. 3 1
      TextFeld.cpp

+ 3 - 1
TextFeld.cpp

@@ -1604,7 +1604,7 @@ bool TextFeld::isCharSelected( int index ) const
 //  return: -1, falls sich an der Position kein zeichen befindet
 int TextFeld::getTextIndexAt( int mx, int my ) const
 {
-    if( !tm || !tm->text )
+    if( !tm || !tm->text || !tm->zCurrentRenderer() )
         return -1;
     int tbr = getTextWidth();
     int thi = getTextHeight();
@@ -1655,6 +1655,8 @@ int TextFeld::getTextIndexAt( int mx, int my ) const
 //  my: die y position der maus relativ zut position des textfeldes
 int TextFeld::getCurserPosAt( int mx, int my ) const
 {
+    if( !tm || !tm->text || !tm->zCurrentRenderer() )
+        return tm->text->getLength();
     int tbr = getTextWidth();
     int thi = getTextHeight();
     int xxx = 0;