From 5d276fc2b784cf7f7ed7bc942de365a6d4d125e5 Mon Sep 17 00:00:00 2001 From: lantzelot-swe <75668734+lantzelot-swe@users.noreply.github.com> Date: Thu, 28 Oct 2021 14:46:04 +0200 Subject: [PATCH] fix: New games get "adventure" as genre Previously the genre was empty if you didn't explicitly select a value in the genre drop down box before saving. --- src/main/java/se/lantz/model/MainViewModel.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/se/lantz/model/MainViewModel.java b/src/main/java/se/lantz/model/MainViewModel.java index 303322a..6247b5b 100644 --- a/src/main/java/se/lantz/model/MainViewModel.java +++ b/src/main/java/se/lantz/model/MainViewModel.java @@ -486,7 +486,8 @@ public class MainViewModel extends AbstractModel updatedGame.setAuthor(infoModel.getAuthor().replace("\"", "\"\"")); updatedGame.setYear(infoModel.getYear()); updatedGame.setComposer(infoModel.getComposer().replace("\"", "\"\"")); - updatedGame.setGenre(infoModel.getGenre()); + //If no genre selected use "adventure". + updatedGame.setGenre(infoModel.getGenre().isEmpty() ? "adventure" : infoModel.getGenre()); updatedGame.setDescription(infoModel.getDescription().replace("\"", "\"\"")); updatedGame.setDescriptionDe(infoModel.getDescriptionDe().replace("\"", "\"\"")); updatedGame.setDescriptionFr(infoModel.getDescriptionFr().replace("\"", "\"\""));