Check for NULL pointer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16307 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -393,6 +393,9 @@ void wxTextCtrl::Remove(long from, long to)
|
|||||||
|
|
||||||
void wxTextCtrl::SetSelection(long from, long to)
|
void wxTextCtrl::SetSelection(long from, long to)
|
||||||
{
|
{
|
||||||
|
if( to == -1 )
|
||||||
|
to = GetLastPosition();
|
||||||
|
|
||||||
XmTextSetSelection ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
|
XmTextSetSelection ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
|
||||||
(Time) 0);
|
(Time) 0);
|
||||||
}
|
}
|
||||||
@@ -760,7 +763,9 @@ static void MergeChangesIntoString(wxString& value,
|
|||||||
const char * const passwd = value;
|
const char * const passwd = value;
|
||||||
int len = value.length();
|
int len = value.length();
|
||||||
|
|
||||||
len += strlen(cbs->text->ptr) + 1; // + new text (if any) + NUL
|
len += ( cbs->text->ptr ?
|
||||||
|
strlen(cbs->text->ptr) :
|
||||||
|
0 ) + 1; // + new text (if any) + NUL
|
||||||
len -= cbs->endPos - cbs->startPos; // - text from affected region.
|
len -= cbs->endPos - cbs->startPos; // - text from affected region.
|
||||||
|
|
||||||
char * newS = new char [len];
|
char * newS = new char [len];
|
||||||
@@ -774,6 +779,7 @@ static void MergeChangesIntoString(wxString& value,
|
|||||||
*dest++ = *p++;
|
*dest++ = *p++;
|
||||||
|
|
||||||
// Copy the text to be inserted).
|
// Copy the text to be inserted).
|
||||||
|
if (insert)
|
||||||
while (*insert)
|
while (*insert)
|
||||||
*dest++ = *insert++;
|
*dest++ = *insert++;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user