summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2023-11-23 23:25:00 +0100
committerMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2023-11-23 23:25:00 +0100
commit3de9afc4a94932993532cb263ebbcd843865181d (patch)
tree8e355ef5ba2bc70ad7a42e81a35e5712f0783268
parentce3bac5f55507a81fb76eb0fc0b37693f663dad0 (diff)
downloadredot-engine-3de9afc4a94932993532cb263ebbcd843865181d.tar.gz
Fix crash when hiding a Control during mouse-entering
gui.mouse_over can be set to `nullptr` in the `NOTIFICATION_MOUSE_ENTER`- user-callback a few lines above. This case was previously not handled.
-rw-r--r--scene/main/viewport.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 43bdb1395b..e9ea09a3b1 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -3207,7 +3207,9 @@ void Viewport::_update_mouse_over(Vector2 p_pos) {
}
// Send Mouse Enter Self notification.
- gui.mouse_over->notification(Control::NOTIFICATION_MOUSE_ENTER_SELF);
+ if (gui.mouse_over) {
+ gui.mouse_over->notification(Control::NOTIFICATION_MOUSE_ENTER_SELF);
+ }
notify_embedded_viewports = true;
}