From 670e6be39a3621aabfd93e3f0eac7c3554b8cadd Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 17 Apr 2017 15:42:09 +0200 Subject: [PATCH] fix fallthrough setting of localized metadata entries Java's Map.get() returns null if there is no match, so this was always setting each entry to whatever value was in the highest priority locale, whether it had contents or what null. Now, this will fall through the priority list of locales until it finds actually contents. --- app/src/main/java/org/fdroid/fdroid/data/App.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/fdroid/fdroid/data/App.java b/app/src/main/java/org/fdroid/fdroid/data/App.java index 066fa6296..e1d46ea26 100644 --- a/app/src/main/java/org/fdroid/fdroid/data/App.java +++ b/app/src/main/java/org/fdroid/fdroid/data/App.java @@ -433,7 +433,10 @@ public class App extends ValueObject implements Comparable, Parcelable { try { for (String locale : locales) { if (localized.containsKey(locale)) { - return (String) localized.get(locale).get(key); + String value = (String) localized.get(locale).get(key); + if (value != null) { + return value; + } } } } catch (ClassCastException e) {