Fix for access of undefined ground object in UI code giving pointless
authorLukas Tönne <lukas.toenne@gmail.com>
Mon, 22 Dec 2014 10:24:19 +0000 (11:24 +0100)
committerLukas Tönne <lukas.toenne@gmail.com>
Mon, 22 Dec 2014 10:25:03 +0000 (11:25 +0100)
exceptions.

object_physics_meadow/ui.py

index dedf97d..9366cbf 100644 (file)
@@ -105,14 +105,15 @@ class OBJECT_PT_Meadow(Panel):
         row.operator("meadow.bake_physics", icon='MOD_PHYSICS')
         row.operator("meadow.free_physics", icon='X')
 
-        row = layout.row()
-        row.prop(groundob.meadow, "use_layers")
-        sub = row.row()
-        if groundob.meadow.use_layers:
-            sub.template_layers(groundob.meadow, "layers", groundob.meadow, "used_layers", -1)
-        else:
-            sub.enabled = False
-            sub.template_layers(groundob, "layers", groundob.meadow, "used_layers", -1)
+        if groundob:
+            row = layout.row()
+            row.prop(groundob.meadow, "use_layers")
+            sub = row.row()
+            if groundob.meadow.use_layers:
+                sub.template_layers(groundob.meadow, "layers", groundob.meadow, "used_layers", -1)
+            else:
+                sub.enabled = False
+                sub.template_layers(groundob, "layers", groundob.meadow, "used_layers", -1)
 
 
 class MeadowOperatorBase():