added null pointer check to EaglerAdapterImpl2

This commit is contained in:
LAX1DUDE 2021-11-05 20:21:16 -07:00 committed by GitHub
parent c4577eb1d3
commit c88fd11db4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1114,6 +1114,7 @@ public class EaglerAdapterImpl2 {
AudioBufferX ret = loadedSoundFiles.get(fileName); AudioBufferX ret = loadedSoundFiles.get(fileName);
if(ret == null) { if(ret == null) {
byte[] file = loadResourceBytes(fileName); byte[] file = loadResourceBytes(fileName);
if(file == null) return null;
Uint8Array buf = Uint8Array.create(file.length); Uint8Array buf = Uint8Array.create(file.length);
buf.set(file); buf.set(file);
ret = new AudioBufferX(decodeAudioAsync(buf.getBuffer())); ret = new AudioBufferX(decodeAudioAsync(buf.getBuffer()));