فهرست منبع

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

Kolja Strohm 3 سال پیش
والد
کامیت
c745d98f84
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  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;