From 203138ddbd9b83fc2dcceeb6d84da6b4c4e20ea3 Mon Sep 17 00:00:00 2001 From: Viktor Govako Date: Thu, 16 Jun 2022 07:00:49 +0300 Subject: [PATCH] [android] Do not crash on absent category type translation. Signed-off-by: Viktor Govako --- android/src/com/mapswithme/util/Utils.java | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/android/src/com/mapswithme/util/Utils.java b/android/src/com/mapswithme/util/Utils.java index c526eb442c..5e63ffd034 100644 --- a/android/src/com/mapswithme/util/Utils.java +++ b/android/src/com/mapswithme/util/Utils.java @@ -608,11 +608,9 @@ public class Utils @NonNull public static String getStringValueByKey(@NonNull Context context, @NonNull String key) { - @StringRes - int id = getStringIdByKey(context, key); try { - return context.getString(id); + return context.getString(getStringIdByKey(context, key)); } catch (Resources.NotFoundException e) { @@ -722,19 +720,7 @@ public class Utils @NonNull private static String getLocalizedFeatureByKey(@NonNull Context context, @NonNull String key) { - @StringRes - int id = getStringIdByKey(context, key); - - try - { - return context.getString(id); - } - catch (Resources.NotFoundException e) - { - Logger.e(TAG, "Failed to get localized string for key '" + key + "'", e); - } - - return key; + return getStringValueByKey(context, key); } @NonNull