diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2024-10-10 22:09:11 -0400 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2024-10-10 22:09:11 -0400 |
commit | 4375a10321671e40e8695101c9a59191a331fee2 (patch) | |
tree | 16670c2f129be23ccf61d25ddae76037bf34b239 | |
parent | f48b8c837db34878b1ce500dc1f3dd0cf162a97c (diff) | |
download | NPEhero-4375a10321671e40e8695101c9a59191a331fee2.tar.gz NPEhero-4375a10321671e40e8695101c9a59191a331fee2.tar.bz2 NPEhero-4375a10321671e40e8695101c9a59191a331fee2.zip |
Fix level creation crash, improve exception display
-rw-r--r-- | pom.xml | 4 | ||||
-rwxr-xr-x | src/main/java/net/sowgro/npehero/levelapi/Level.java | 4 | ||||
-rw-r--r-- | src/main/java/net/sowgro/npehero/main/ErrorDisplay.java | 6 |
3 files changed, 9 insertions, 5 deletions
@@ -97,7 +97,7 @@ <jlinkZipName>NPEHero</jlinkZipName> <jlinkImageName>app</jlinkImageName> <noManPages>true</noManPages> - <stripDebug>true</stripDebug> +<!-- <stripDebug>true</stripDebug>--> <noHeaderFiles>true</noHeaderFiles> <options>-Dprism.forceGPU=true</options> <compress>0</compress> @@ -148,7 +148,7 @@ </goals> <phase>package</phase> <configuration> - <name>npehero_installer</name> + <name>NPEHero</name> <linuxShortcut>true</linuxShortcut> <linuxMenuGroup>Game</linuxMenuGroup> diff --git a/src/main/java/net/sowgro/npehero/levelapi/Level.java b/src/main/java/net/sowgro/npehero/levelapi/Level.java index 9b54207..7830c16 100755 --- a/src/main/java/net/sowgro/npehero/levelapi/Level.java +++ b/src/main/java/net/sowgro/npehero/levelapi/Level.java @@ -11,6 +11,7 @@ import javafx.scene.paint.Color; import java.nio.file.Files; import java.nio.file.StandardCopyOption; +import java.util.HashMap; import java.util.Map; public class Level implements Comparable<Level>{ @@ -131,6 +132,9 @@ public class Level implements Comparable<Level>{ } @SuppressWarnings("unchecked") Map<String, Object> data = jsonParser.fromJson(new FileReader(jsonFile), Map.class); + if (data == null) { + data = new HashMap<>(); + } data.put("title", title); data.put("artist", artist); data.put("desc", desc); diff --git a/src/main/java/net/sowgro/npehero/main/ErrorDisplay.java b/src/main/java/net/sowgro/npehero/main/ErrorDisplay.java index cd43937..32f7a63 100644 --- a/src/main/java/net/sowgro/npehero/main/ErrorDisplay.java +++ b/src/main/java/net/sowgro/npehero/main/ErrorDisplay.java @@ -86,14 +86,14 @@ public class ErrorDisplay extends Page { stackTrace.setManaged(true); }); - HBox buttonBox = new HBox(exit, showStack); + HBox buttonBox = new HBox(exit, showStack, printStack); buttonBox.setSpacing(10); - VBox main = new VBox(title, exView); + VBox main = new VBox(title, exView, stackTrace); main.getStyleClass().add("box"); VBox centerBox = new VBox(); - centerBox.getChildren().addAll(main, buttonBox, stackTrace); + centerBox.getChildren().addAll(main, buttonBox); centerBox.setSpacing(10); centerBox.setAlignment(Pos.CENTER); |