Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ private VBox setUpCenterBox() {
* @param gameUI the {@code BorderPane} layout to be used as the root of the new scene
*/
private void createAndSetScene(BorderPane gameUI) {
try {
// SAFETY: Always ensure the root node is not already attached to another scene
if (gameUI.getScene() != null) {
// Detach from previous scene to avoid IllegalArgumentException
Expand All @@ -217,6 +218,9 @@ private void createAndSetScene(BorderPane gameUI) {
getClass().getResource("/style/snakesandladders.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Game UI was null, but application should not crash.");
}
}

/**
Expand Down