Fix NULL pointer dereference in wxTextCtrl::GetStyle() with GTK3

Pointers in rgba array can be NULL.
This commit is contained in:
Paul Cornett
2019-07-20 22:16:17 -07:00
parent e2332f2703
commit 211a42ef12

View File

@@ -1882,8 +1882,10 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
else // have custom attributes else // have custom attributes
{ {
#ifdef __WXGTK3__ #ifdef __WXGTK3__
style.SetBackgroundColour(*pattr->appearance.rgba[0]); if (GdkRGBA* rgba = pattr->appearance.rgba[0])
style.SetTextColour(*pattr->appearance.rgba[1]); style.SetBackgroundColour(*rgba);
if (GdkRGBA* rgba = pattr->appearance.rgba[1])
style.SetTextColour(*rgba);
#else #else
style.SetBackgroundColour(pattr->appearance.bg_color); style.SetBackgroundColour(pattr->appearance.bg_color);
style.SetTextColour(pattr->appearance.fg_color); style.SetTextColour(pattr->appearance.fg_color);