浏览代码

Merge pull request #10524 from hpvb/fix-10515

Add null check to ParallaxLayer get_parent() calls
Rémi Verschelde 8 年之前
父节点
当前提交
733125b7a5
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      scene/2d/parallax_layer.cpp

+ 6 - 0
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>();