fix: no null pointer exceptions if the user can't see anything :)

This commit is contained in:
Zhongheng Liu 2025-12-04 22:13:22 +01:00
commit c2fa31aa9f
Signed by: steven
GPG key ID: F69B980899C1C09D

View file

@ -203,8 +203,8 @@ public class FoodpalApplicationCtrl implements LocaleAware {
// Select first recipe in the list by default // Select first recipe in the list by default
if (!recipes.isEmpty()) { if (!recipes.isEmpty()) {
recipeList.getSelectionModel().selectFirst(); recipeList.getSelectionModel().selectFirst();
detailsScreen.visibleProperty().set(true);
} }
detailsScreen.visibleProperty().set(!recipes.isEmpty());
} }
private void printError(String msg) { private void printError(String msg) {
Alert alert = new Alert(Alert.AlertType.ERROR); Alert alert = new Alert(Alert.AlertType.ERROR);