diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-29 13:34:00 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-29 13:34:00 -0400 |
commit | 2b0fcdde3144213676324163d721150a8641d610 (patch) | |
tree | d2a342d001a9d279538ef89e06cc2e5c0169acff | |
parent | 6c3cb6286ae94bc41d07d4886e93b2e7d2489a28 (diff) | |
download | lingo-archipelago-2b0fcdde3144213676324163d721150a8641d610.tar.gz lingo-archipelago-2b0fcdde3144213676324163d721150a8641d610.tar.bz2 lingo-archipelago-2b0fcdde3144213676324163d721150a8641d610.zip |
Gracefully handle corrupted data files
-rw-r--r-- | Archipelago/client.gd | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index e89c156..bc952b9 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd | |||
@@ -133,6 +133,10 @@ func _init(): | |||
133 | var data = file.get_var(true) | 133 | var data = file.get_var(true) |
134 | file.close() | 134 | file.close() |
135 | 135 | ||
136 | if typeof(data) != TYPE_ARRAY: | ||
137 | global._print("AP settings file is corrupted") | ||
138 | data = [] | ||
139 | |||
136 | if data.size() > 0: | 140 | if data.size() > 0: |
137 | ap_server = data[0] | 141 | ap_server = data[0] |
138 | if data.size() > 1: | 142 | if data.size() > 1: |
@@ -328,6 +332,10 @@ func _on_data(): | |||
328 | var localdata = ap_file.get_var(true) | 332 | var localdata = ap_file.get_var(true) |
329 | ap_file.close() | 333 | ap_file.close() |
330 | 334 | ||
335 | if typeof(localdata) != TYPE_ARRAY: | ||
336 | global._print("AP localdata file is corrupted") | ||
337 | localdata = [] | ||
338 | |||
331 | if localdata.size() > 0: | 339 | if localdata.size() > 0: |
332 | _last_new_item = localdata[0] | 340 | _last_new_item = localdata[0] |
333 | else: | 341 | else: |