diff --git a/backends/backend-teavm/src/main/java/com/github/xpenatan/gdx/backends/teavm/filesystem/MemoryFileStorage.java b/backends/backend-teavm/src/main/java/com/github/xpenatan/gdx/backends/teavm/filesystem/MemoryFileStorage.java index 32bd36bc..98d38f04 100644 --- a/backends/backend-teavm/src/main/java/com/github/xpenatan/gdx/backends/teavm/filesystem/MemoryFileStorage.java +++ b/backends/backend-teavm/src/main/java/com/github/xpenatan/gdx/backends/teavm/filesystem/MemoryFileStorage.java @@ -25,6 +25,9 @@ public MemoryFileStorage() { public InputStream read(TeaFileHandle file) { String path = fixPath(file.path()); FileData data = getInternal(path); + if(data == null) { + return null; + } byte[] byteArray = data.getBytes(); try { return new ByteArrayInputStream(byteArray); @@ -32,7 +35,7 @@ public InputStream read(TeaFileHandle file) { catch(RuntimeException e) { // Something corrupted: we remove it & re-throw the error removeInternal(path); - throw e; + throw new GdxRuntimeException(getClass().getSimpleName() + " Error: " + path, e); } } @@ -299,6 +302,9 @@ private String[] list(FileHandle file, boolean equals) { String[] str = new String[tmpPaths.size]; for(int i = 0; i < tmpPaths.size; i++) { String s = tmpPaths.get(i); + if(s.startsWith("/")) { + s = s.substring(1); + } if(debug) { System.out.println(getClass().getSimpleName() + " LIST[" + i + "]: " + s); }