Read corrupted save and settings files without engine error logs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Denis Defolie
2026-10-17 21:04:51 +02:00
parent 97351c40a6
commit d734d603c5
3 changed files with 9 additions and 3 deletions
+6 -1
View File
@@ -87,7 +87,12 @@ static func _read_raw_json(path: String) -> Variant:
var text := file.get_as_text()
if text.strip_edges().is_empty():
return null
return JSON.parse_string(text)
# JSON.new().parse : un fichier corrompu est un cas normal (repli sur la
# copie de secours), pas une erreur moteur a journaliser.
var json := JSON.new()
if json.parse(text) != OK:
return null
return json.data
static func _copy_file(from_path: String, to_path: String) -> void: