summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-07-20 12:00:13 +0200
committerGitHub <noreply@github.com>2019-07-20 12:00:13 +0200
commitd15cf7b672ac9911b4e82fed52b4c5e8d4312b0d (patch)
tree68ab08fafd7e14710ce245a47f3bb518ebf03307 /scene/main
parent700938bff772924941c4e1ea61bbfd2abe34d8d2 (diff)
parent6cbaf7662f5ee3ca1d02c0ebc85854fceee057af (diff)
Merge pull request #30576 from qarmin/lgtm_coverage
Changed some code reported by LGTM and Coverity
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/node.cpp2
-rw-r--r--scene/main/viewport.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 06d6f0871c..caa0da5d1f 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -210,7 +210,7 @@ void Node::_propagate_enter_tree() {
}
data.viewport = Object::cast_to<Viewport>(this);
- if (!data.viewport)
+ if (!data.viewport && data.parent)
data.viewport = data.parent->data.viewport;
data.inside_tree = true;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index d147d43f50..9466b7c5c1 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -581,7 +581,7 @@ void Viewport::_notification(int p_what) {
if (physics_object_capture != 0) {
CollisionObject *co = Object::cast_to<CollisionObject>(ObjectDB::get_instance(physics_object_capture));
- if (co) {
+ if (co && camera) {
_collision_object_input_event(co, camera, ev, Vector3(), Vector3(), 0);
captured = true;
if (mb.is_valid() && mb->get_button_index() == 1 && !mb->is_pressed()) {