From 99617ae8dcf98395c5aae78acfe38373bfeb2994 Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam Date: Tue, 22 Aug 2017 01:47:22 +0200 Subject: Add null check to ParallaxLayer get_parent() calls This fixes #10515 --- scene/2d/parallax_layer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scene') diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp index a5a59252a9..4b62d70648 100644 --- a/scene/2d/parallax_layer.cpp +++ b/scene/2d/parallax_layer.cpp @@ -34,6 +34,9 @@ void ParallaxLayer::set_motion_scale(const Size2 &p_scale) { + if (!get_parent()) + return; + motion_scale = p_scale; ParallaxBackground *pb = get_parent()->cast_to(); @@ -51,6 +54,9 @@ Size2 ParallaxLayer::get_motion_scale() const { void ParallaxLayer::set_motion_offset(const Size2 &p_offset) { + if (!get_parent()) + return; + motion_offset = p_offset; ParallaxBackground *pb = get_parent()->cast_to(); -- cgit v1.2.3