From 12904e220ae81efffb2cdeae3c4fcdcdb32311b8 Mon Sep 17 00:00:00 2001 From: HSoreide <sofie.scisly@gmail.com> Date: Tue, 18 Apr 2023 14:47:07 +0200 Subject: [PATCH] Add check for Apply button being present --- .../idatt1002/demo/controller/SuggestRecipesController.java | 2 +- src/main/resources/recipes/Recipes.register | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/no/ntnu/idatt1002/demo/controller/SuggestRecipesController.java b/src/main/java/no/ntnu/idatt1002/demo/controller/SuggestRecipesController.java index def104b7..83e531dd 100644 --- a/src/main/java/no/ntnu/idatt1002/demo/controller/SuggestRecipesController.java +++ b/src/main/java/no/ntnu/idatt1002/demo/controller/SuggestRecipesController.java @@ -73,7 +73,7 @@ public class SuggestRecipesController implements Initializable { Optional<ButtonType> clickedButton = dialog.showAndWait(); - if (clickedButton.get() == ButtonType.APPLY) { + if (clickedButton.isPresent() && clickedButton.get() == ButtonType.APPLY) { // Refresh ingredientsAtHand. ingredientsAtHand = FileHandler.readIngredientsAtHand("Fridge"); //TODO: Duplicate code and assertion. diff --git a/src/main/resources/recipes/Recipes.register b/src/main/resources/recipes/Recipes.register index 6c79274d..70dd0e99 100644 --- a/src/main/resources/recipes/Recipes.register +++ b/src/main/resources/recipes/Recipes.register @@ -1,4 +1,4 @@ -# Enkel pastasalat +# Simple Pasta Salad - PASTA | 300 | GR - OLIVE_OIL | 2 | TBS -- GitLab