]> git.saurik.com Git - wxWidgets.git/commitdiff
wxTextCtrk::GetRange() shouldn't crash on out of range request
authorRobert Roebling <robert@roebling.de>
Fri, 23 May 2008 19:41:32 +0000 (19:41 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 23 May 2008 19:41:32 +0000 (19:41 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53729 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/textentrycmn.cpp

index c6b769601e4256fe2863a0afcb8c347c5b32a15c..5ec6850708fdb42077a14be4657664141676f8fb 100644 (file)
@@ -40,7 +40,9 @@
 wxString wxTextEntryBase::GetRange(long from, long to) const
 {
     wxString sel;
-    if ( from < to )
+    wxString value = GetValue();
+    
+    if ((from < to) && ((long)value.length() >= to + from))
     {
         sel = GetValue().substr(from, to - from);
     }