Skip to content

Commit 5a2ecb3

Browse files
authored
Added failsafe if data byte is not found
1 parent 4faf408 commit 5a2ecb3

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

GDScriptAudioImport.gd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ func loadfile(filepath):
6666
var bits_per_sample = 0
6767
var i = 0
6868
while true:
69+
if i >= len(bytes) - 4: # Failsafe, if there is no data bytes
70+
print("Data byte not found")
71+
break
72+
6973
var those4bytes = str(char(bytes[i])+char(bytes[i+1])+char(bytes[i+2])+char(bytes[i+3]))
7074

7175
if those4bytes == "RIFF":

0 commit comments

Comments
 (0)