From e9863f4ea1ab957e59b421d36e6199c7b472476d Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 23 May 2008 19:41:32 +0000 Subject: [PATCH] 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 --- src/common/textentrycmn.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } -- 2.45.2