From b238b50dc6b683b7ed6b1aec986d77011e734ed4 Mon Sep 17 00:00:00 2001 From: Michael Berry Date: Thu, 9 Sep 2021 22:52:31 +0100 Subject: [PATCH] 2021.0 hotfix - language change no longer causes crash --- .../org/quelea/data/displayable/TextAlignment.java | 6 +++--- .../org/quelea/services/utils/QueleaProperties.java | 2 +- .../windows/options/PreferenceStorageHandler.java | 11 +++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Quelea/src/main/java/org/quelea/data/displayable/TextAlignment.java b/Quelea/src/main/java/org/quelea/data/displayable/TextAlignment.java index da919036f..1f0218dfd 100644 --- a/Quelea/src/main/java/org/quelea/data/displayable/TextAlignment.java +++ b/Quelea/src/main/java/org/quelea/data/displayable/TextAlignment.java @@ -52,17 +52,17 @@ public String toFriendlyString() { * @return the text alignment object. */ public static TextAlignment parse(String val) { - if(val.equals(LabelGrabber.INSTANCE.getLabel("left"))) { + if(val.equalsIgnoreCase(LabelGrabber.INSTANCE.getLabel("left"))) { return TextAlignment.LEFT; } // else if(val.equals(LabelGrabber.INSTANCE.getLabel("right"))) { // return TextAlignment.RIGHT; // } - else if(val.equals(LabelGrabber.INSTANCE.getLabel("centre"))) { + else if(val.equalsIgnoreCase(LabelGrabber.INSTANCE.getLabel("centre"))) { return TextAlignment.CENTRE; } else { - return null; + return TextAlignment.LEFT; } } } diff --git a/Quelea/src/main/java/org/quelea/services/utils/QueleaProperties.java b/Quelea/src/main/java/org/quelea/services/utils/QueleaProperties.java index be91992bd..793262893 100644 --- a/Quelea/src/main/java/org/quelea/services/utils/QueleaProperties.java +++ b/Quelea/src/main/java/org/quelea/services/utils/QueleaProperties.java @@ -886,7 +886,7 @@ public void setStageTextFont(String font) { * @return the alignment of the text on stage view. */ public String getStageTextAlignment() { - return TextAlignment.valueOf(getProperty(stageTextAlignmentKey, "LEFT")).toFriendlyString(); + return TextAlignment.parse(getProperty(stageTextAlignmentKey, "LEFT")).toFriendlyString(); } /** diff --git a/Quelea/src/main/java/org/quelea/windows/options/PreferenceStorageHandler.java b/Quelea/src/main/java/org/quelea/windows/options/PreferenceStorageHandler.java index ff264ba0b..ad28859e7 100644 --- a/Quelea/src/main/java/org/quelea/windows/options/PreferenceStorageHandler.java +++ b/Quelea/src/main/java/org/quelea/windows/options/PreferenceStorageHandler.java @@ -249,10 +249,13 @@ public void saveObject(String breadcrumb, Object object) { case QueleaPropertyKeys.smallSongTextHPositionKey: case QueleaPropertyKeys.smallSongTextVPositionKey: case QueleaPropertyKeys.stageTextAlignmentKey: - String pos = LabelGrabber.INSTANCE.getEngKey(object.toString()).toLowerCase(); - if (breadcrumb.contains("alignment")) - pos = pos.toUpperCase(); - QueleaProperties.get().setProperty(breadcrumb, pos); + String pos = LabelGrabber.INSTANCE.getEngKey(object.toString()); + if (pos != null) { + pos = pos.toLowerCase(); + if (breadcrumb.contains("alignment")) + pos = pos.toUpperCase(); + QueleaProperties.get().setProperty(breadcrumb, pos); + } break; case QueleaPropertyKeys.mobLyricsPortKey: case QueleaPropertyKeys.remoteControlPortKey: