From: Robert Roebling Date: Fri, 23 May 2008 19:41:32 +0000 (+0000) Subject: wxTextCtrk::GetRange() shouldn't crash on out of range request X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e9863f4ea1ab957e59b421d36e6199c7b472476d wxTextCtrk::GetRange() shouldn't crash on out of range request git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53729 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/textentrycmn.cpp b/src/common/textentrycmn.cpp index c6b769601e..5ec6850708 100644 --- a/src/common/textentrycmn.cpp +++ b/src/common/textentrycmn.cpp @@ -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); }