Skip to content

Commit c9c7c86

Browse files
committed
Hotfix, prevent error when no drops exist
1 parent 88aabc9 commit c9c7c86

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

main.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,9 @@ def modifysave(data, shash):
541541
# Clear the drop data when requested
542542
if len(data["drops"]) < len(savefiles[shash]["savedata"]["drops"]["v"]):
543543
savefiles[shash]["savedata"]["drops"] = modifyvaluetype(shash, savefiles[shash]["savedata"]["drops"], [])
544-
savefiles[shash]["savedata"]["map"]["v"]["1968591194"] = modifyvaluetype(shash, savefiles[shash]["savedata"]["map"]["v"]["1968591194"], [])
544+
# Check first if they exist
545+
if "1968591194" in savefiles[shash]["savedata"]["map"]["v"]:
546+
savefiles[shash]["savedata"]["map"]["v"]["1968591194"] = modifyvaluetype(shash, savefiles[shash]["savedata"]["map"]["v"]["1968591194"], [])
545547

546548

547549
# Made for the basic types, not made for Vector2, Vector3, ...
@@ -706,9 +708,12 @@ def editablevalues(shash):
706708
# To display the objects which will get deleted when you clear the drops we extract them
707709
for drop in data["savedata"]["drops"]["v"]:
708710
obj["drops"].append(drop["v"]["res"]["v"]["id"]["v"])
709-
for drop in data["savedata"]["map"]["v"]["1968591194"]["v"]:
710-
types = ["Red points", "Blue points", "Green points"]
711-
obj["drops"].append(types[drop["v"]["type"]["v"]["1826761547"]["v"]])
711+
712+
# Check first if the entry actually exists
713+
if "1968591194" in data["savedata"]["map"]["v"]:
714+
for drop in data["savedata"]["map"]["v"]["1968591194"]["v"]:
715+
types = ["Red points", "Blue points", "Green points"]
716+
obj["drops"].append(types[drop["v"]["type"]["v"]["1826761547"]["v"]])
712717

713718
# Variables to determine if all bodies in the graves / all workers get turned into perfect bodies / workers
714719
obj["switches"] = {

0 commit comments

Comments
 (0)