summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-08-22 08:08:31 +0200
committerGitHub <noreply@github.com>2017-08-22 08:08:31 +0200
commit733125b7a5c424efda7a995263282f42b89ddbb8 (patch)
tree9f3367d6eb6f37c421221f5ed28b233ab8c76abd
parent411f0755a848e02811baf4062f51906c86a5e994 (diff)
parent99617ae8dcf98395c5aae78acfe38373bfeb2994 (diff)
Merge pull request #10524 from hpvb/fix-10515
Add null check to ParallaxLayer get_parent() calls
-rw-r--r--scene/2d/parallax_layer.cpp6
1 files changed, 6 insertions, 0 deletions
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<ParallaxBackground>();
@@ -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<ParallaxBackground>();