aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2024-10-10 22:09:11 -0400
committersowgro <tpoke.ferrari@gmail.com>2024-10-10 22:09:11 -0400
commit4375a10321671e40e8695101c9a59191a331fee2 (patch)
tree16670c2f129be23ccf61d25ddae76037bf34b239
parentf48b8c837db34878b1ce500dc1f3dd0cf162a97c (diff)
downloadNPEhero-4375a10321671e40e8695101c9a59191a331fee2.tar.gz
NPEhero-4375a10321671e40e8695101c9a59191a331fee2.tar.bz2
NPEhero-4375a10321671e40e8695101c9a59191a331fee2.zip
Fix level creation crash, improve exception display
-rw-r--r--pom.xml4
-rwxr-xr-xsrc/main/java/net/sowgro/npehero/levelapi/Level.java4
-rw-r--r--src/main/java/net/sowgro/npehero/main/ErrorDisplay.java6
3 files changed, 9 insertions, 5 deletions
diff --git a/pom.xml b/pom.xml
index 7aeddcd..b28bdcd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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);