Check for variable being non-NULL before using it

The "buffer" argument can apparently be null, as there is a check for this on
the next line, but it was used without checking that this is the case.

Fix this, although it's not totally clear if "buffer" can really be null at
all and maybe the check below should have been removed instead -- but prefer
to err on the side of caution.

Thanks to PVS-Studio for finding this issue (V595 The 'buffer' pointer was
utilized before it was verified against nullptr).
This commit is contained in:
Ilya Ivanov 2017-04-27 15:06:56 +03:00 committed by Vadim Zeitlin
parent b65a3ad736
commit ab7c39fddb

View File

@ -9932,7 +9932,7 @@ bool wxRichTextCell::EditProperties(wxWindow* parent, wxRichTextBuffer* buffer)
wxRichTextAttr attr;
wxRichTextSelection sel;
if (buffer->GetRichTextCtrl())
if (buffer && buffer->GetRichTextCtrl())
sel = buffer->GetRichTextCtrl()->GetSelection();
if (table && buffer && buffer->GetRichTextCtrl() && sel.IsValid() &&