mirror of
https://github.com/godotengine/godot.git
synced 2024-12-09 10:09:20 +08:00
Fix Viewport crashes when not in tree
This commit is contained in:
parent
ccaefbce55
commit
80927b7a81
@ -2547,6 +2547,8 @@ void Viewport::_gui_remove_control(Control *p_control) {
|
||||
}
|
||||
|
||||
Window *Viewport::get_base_window() const {
|
||||
ERR_FAIL_COND_V(!is_inside_tree(), nullptr);
|
||||
|
||||
Viewport *v = const_cast<Viewport *>(this);
|
||||
Window *w = Object::cast_to<Window>(v);
|
||||
while (!w) {
|
||||
@ -3336,6 +3338,7 @@ bool Viewport::is_input_handled() const {
|
||||
return local_input_handled;
|
||||
} else {
|
||||
const Viewport *vp = this;
|
||||
ERR_FAIL_COND_V(!is_inside_tree(), false);
|
||||
while (true) {
|
||||
if (Object::cast_to<Window>(vp)) {
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user