瀏覽代碼

Merge pull request #6717 from Hinsbart/focus_crash

Prevent crash on focus change when no valid next control has been found.
Rémi Verschelde 9 年之前
父節點
當前提交
6f9023c9a6
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      scene/gui/control.cpp

+ 5 - 5
scene/gui/control.cpp

@@ -1725,11 +1725,11 @@ Control *Control::find_next_valid_focus() const {
 
 		if (next_child==this) // no next control->
 			return (get_focus_mode()==FOCUS_ALL)?next_child:NULL;
-
-		if (next_child->get_focus_mode()==FOCUS_ALL)
-			return next_child;
-
-		from = next_child;
+		if (next_child) {
+			if (next_child->get_focus_mode()==FOCUS_ALL)
+				return next_child;
+			from = next_child;
+		} else break;
 	}
 
 	return NULL;