Browse Source

Fix crash when removing SpinBox during text submit

Aaron Franke 2 years ago
parent
commit
d3e4db4a7b
1 changed files with 2 additions and 1 deletions
  1. 2 1
      scene/gui/spin_box.cpp

+ 2 - 1
scene/gui/spin_box.cpp

@@ -202,7 +202,8 @@ void SpinBox::_line_edit_focus_enter() {
 
 void SpinBox::_line_edit_focus_exit() {
 	// Discontinue because the focus_exit was caused by left-clicking the arrows.
-	if (get_viewport()->gui_get_focus_owner() == get_line_edit()) {
+	Viewport *viewport = get_viewport();
+	if (!viewport || viewport->gui_get_focus_owner() == get_line_edit()) {
 		return;
 	}
 	// Discontinue because the focus_exit was caused by right-click context menu.