Explorar o código

Fix crash when removing SpinBox during text submit

Aaron Franke %!s(int64=2) %!d(string=hai) anos
pai
achega
d3e4db4a7b
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  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.