diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-10-09 14:41:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-09 14:41:22 +0200 |
commit | 6f9023c9a609e6f3a8370853266ab06e5f910acd (patch) | |
tree | e064161aebf94f8195feccdc58211032d738340e | |
parent | 9eb54e5b6e89b51fb3287de3b89f009109242bad (diff) | |
parent | 8dd026e4f91f802719315fb6b5a45e36723d3adc (diff) |
Merge pull request #6717 from Hinsbart/focus_crash
Prevent crash on focus change when no valid next control has been found.
-rw-r--r-- | scene/gui/control.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index a5bee32a69..97f0db97c2 100644 --- a/scene/gui/control.cpp +++ b/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; |