summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjitspoe <jitspoe@yahoo.com>2021-09-02 20:40:52 -0400
committerRĂ©mi Verschelde <rverschelde@gmail.com>2021-10-05 12:21:06 +0200
commit2ceba818c36e627b89269ec4a939cf685ef555a3 (patch)
tree76d09f6f3b412bfd2963984c5fb4c7c41a1af634
parentb1c6826b9f84ad564c41a6d1b1e76b09354b8945 (diff)
Fix ViewportTexture error when viewport is used from a child scene
Fix invalid errors when a separate child scene file contains a viewport and that viewport is used for a texture in the current scene. Fixes #27790.
-rw-r--r--scene/main/viewport.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index b3b743370b..e88bb3b952 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -57,17 +57,17 @@
#include "servers/audio_server.h"
void ViewportTexture::setup_local_to_scene() {
+ Node *local_scene = get_local_scene();
+ if (!local_scene) {
+ return;
+ }
+
if (vp) {
vp->viewport_textures.erase(this);
}
vp = nullptr;
- Node *local_scene = get_local_scene();
- if (!local_scene) {
- return;
- }
-
Node *vpn = local_scene->get_node(path);
ERR_FAIL_COND_MSG(!vpn, "ViewportTexture: Path to node is invalid.");