]> rtime.felk.cvut.cz Git - hubacji1/iamcar2.git/commitdiff
Fix plot when obst in json is null
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Tue, 14 Mar 2023 14:57:41 +0000 (15:57 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Tue, 14 Mar 2023 14:57:43 +0000 (15:57 +0100)
scripts/plot_json_objects_scenario.py

index 76e29cf7ef54fae86b6628c96e3e2d1d47d60748..b8a4d163b04de60478adfb318e06891d1237f24b 100755 (executable)
@@ -316,7 +316,8 @@ if __name__ == "__main__":
     MINY = scenario["init"][1]
     MAXX = scenario["init"][0]
     MAXY = scenario["init"][1]
-    if "obst" in scenario and  len(scenario["obst"]) > 0:
+    if ("obst" in scenario and isinstance(scenario["obst"], list)
+            and len(scenario["obst"]) > 0):
         for o in scenario["obst"]:
             if not o:
                 continue
@@ -542,7 +543,8 @@ if __name__ == "__main__":
             lw=0,
         )
     # Plot obstacles, slot.
-    if "obst" in scenario and len(scenario["obst"]) > 0:
+    if ("obst" in scenario and isinstance(scenario["obst"], list)
+            and len(scenario["obst"]) > 0):
         for o in scenario["obst"]:
             if not o:
                 continue