From: Julian Smart Date: Thu, 29 Aug 2013 11:41:48 +0000 (+0000) Subject: Crash fix for inserting text into a buffer without an associated control X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/fca66f598520911aea221c043ed05e4f0a9eb1c3 Crash fix for inserting text into a buffer without an associated control git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74727 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index cc52bc9a10..230a8a4731 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -7446,7 +7446,10 @@ bool wxRichTextParagraphLayoutBox::InsertParagraphsWithUndo(wxRichTextBuffer* bu /// Submit command to insert the given text bool wxRichTextBuffer::InsertTextWithUndo(long pos, const wxString& text, wxRichTextCtrl* ctrl, int flags) { - return ctrl->GetFocusObject()->InsertTextWithUndo(this, pos, text, ctrl, flags); + if (ctrl) + return ctrl->GetFocusObject()->InsertTextWithUndo(this, pos, text, ctrl, flags); + else + return wxRichTextParagraphLayoutBox::InsertTextWithUndo(this, pos, text, ctrl, flags); } /// Submit command to insert the given text