From 0d007f1492b4b3daaa62e1787b9e0a469081cc46 Mon Sep 17 00:00:00 2001 From: Amine Bou Date: Fri, 12 Jan 2018 05:19:49 +0100 Subject: [PATCH] Added logging for StringIndexOutOfBound. --- .../apps/amine/bou/readerforselfoss/utils/ItemsUtils.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/utils/ItemsUtils.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/utils/ItemsUtils.kt index 1eda406..a4b3f10 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/utils/ItemsUtils.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/utils/ItemsUtils.kt @@ -2,6 +2,7 @@ package apps.amine.bou.readerforselfoss.utils import android.text.format.DateUtils import apps.amine.bou.readerforselfoss.api.selfoss.Item +import com.crashlytics.android.Crashlytics import java.text.ParseException import java.text.SimpleDateFormat import java.util.* @@ -9,7 +10,12 @@ import java.util.* fun String.toTextDrawableString(): String { val textDrawable = StringBuilder() for (s in this.split(" ".toRegex()).filter { !it.isEmpty() }.toTypedArray()) { - textDrawable.append(s[0]) + try { + textDrawable.append(s[0]) + } catch (e: StringIndexOutOfBoundsException) { + Crashlytics.log(100, "TEXT_DRAWABLE_INDEX_OUT_OF_BOUND", this + " produces ${e.message}") + Crashlytics.logException(e) + } } return textDrawable.toString() }