From dc7c7b7902a90203e492d0497c9a50baaa36bab1 Mon Sep 17 00:00:00 2001 From: scorpion-26 Date: Sun, 5 Nov 2023 22:02:58 +0100 Subject: [PATCH] Add checks for null GtkWidget Gtk complained about invalid widgets, because they were null. --- src/Widget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Widget.cpp b/src/Widget.cpp index c371f38..82e63fd 100644 --- a/src/Widget.cpp +++ b/src/Widget.cpp @@ -162,7 +162,8 @@ void Widget::RemoveChild(Widget* widget) void Widget::SetVisible(bool visible) { - gtk_widget_set_visible(m_Widget, visible); + if (m_Widget) + gtk_widget_set_visible(m_Widget, visible); } void Widget::PropagateToParent(GdkEvent* event) @@ -683,7 +684,8 @@ void Slider::SetOrientation(Orientation orientation) void Slider::SetValue(double value) { - gtk_range_set_value((GtkRange*)m_Widget, value); + if (m_Widget) + gtk_range_set_value((GtkRange*)m_Widget, value); } void Slider::SetInverted(bool inverted)