fix: GameService.load() NPE on null bundleFile + ZipService test path
Build & Deploy / build-and-deploy (push) Successful in 48s

- GameService.load(): null-check bundleFile before resolving path
  (Path.resolve(null) throws NullPointerException)
- ZipServiceTest: pass absolute exePath to createBundle (relativize
  requires both paths to be absolute or both relative)
This commit is contained in:
Hermes Agent
2026-06-10 12:19:41 +02:00
parent ee5f9f5863
commit 5328edad07
2 changed files with 8 additions and 5 deletions
+4 -1
View File
@@ -77,10 +77,13 @@ public class GameService implements GameStore {
);
// Detect bundle size
try {
Path bundlePath = gamesDir.resolve(game.getBundleFile());
String bf = game.getBundleFile();
if (bf != null) {
Path bundlePath = gamesDir.resolve(bf);
if (Files.exists(bundlePath)) {
game.setBundleSize(Files.size(bundlePath));
}
}
} catch (IOException ignored) {}
return game;
}
@@ -154,7 +154,7 @@ class ZipServiceTest {
Path bundlePath = dir.resolve("output.jsdos");
zip.createBundle(extractDir, "game.exe", List.of(), bundlePath);
zip.createBundle(extractDir, extractDir.resolve("game.exe").toString(), List.of(), bundlePath);
assertTrue(Files.exists(bundlePath));
assertTrue(Files.size(bundlePath) > 0);
@@ -193,7 +193,7 @@ class ZipServiceTest {
Path bundlePath = dir.resolve("output.jsdos");
zip.createBundle(extractDir, "game.exe", List.of(), bundlePath);
zip.createBundle(extractDir, extractDir.resolve("game.exe").toString(), List.of(), bundlePath);
try (ZipInputStream zis = new ZipInputStream(Files.newInputStream(bundlePath))) {
ZipEntry entry;