From 211a42ef1229ceb613dd8d709bdc351b2a0d5871 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 20 Jul 2019 22:16:17 -0700 Subject: [PATCH] Fix NULL pointer dereference in wxTextCtrl::GetStyle() with GTK3 Pointers in rgba array can be NULL. --- src/gtk/textctrl.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 9a7e12f5e3..ec30b1de2f 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -1882,8 +1882,10 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style) else // have custom attributes { #ifdef __WXGTK3__ - style.SetBackgroundColour(*pattr->appearance.rgba[0]); - style.SetTextColour(*pattr->appearance.rgba[1]); + if (GdkRGBA* rgba = pattr->appearance.rgba[0]) + style.SetBackgroundColour(*rgba); + if (GdkRGBA* rgba = pattr->appearance.rgba[1]) + style.SetTextColour(*rgba); #else style.SetBackgroundColour(pattr->appearance.bg_color); style.SetTextColour(pattr->appearance.fg_color);