Skip to content

Commit a18fd4a

Browse files
committed
Re-add error fix
1 parent a61c17f commit a18fd4a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Source/Scripts/File.gd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ static func read(path:String)->String:
55

66
## Reads the file as a UTF-8 string and parses a JSON element.
77
static func read_json(path:String)->Variant:
8-
return JSON.parse_string(read(path))
8+
var text:String = read(path)
9+
if text.is_empty():
10+
return null
11+
#end
12+
return JSON.parse_string(text)
913
#end
1014

1115
## Writes the UTF-8 string to the file.

0 commit comments

Comments
 (0)