diff --git a/app/src/main/java/net/pokeranalytics/android/ui/fragment/SubscriptionFragment.kt b/app/src/main/java/net/pokeranalytics/android/ui/fragment/SubscriptionFragment.kt index d3f6fb70..e11b4680 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/fragment/SubscriptionFragment.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/fragment/SubscriptionFragment.kt @@ -1,5 +1,6 @@ package net.pokeranalytics.android.ui.fragment +import android.content.res.Resources import android.graphics.drawable.GradientDrawable import android.os.Build import android.os.Bundle @@ -118,14 +119,21 @@ class SubscriptionFragment : BaseFragment(), SkuDetailsResponseListener, Purchas if (indexOfLastSpace >= 0) { - val end = upgradeString.chars().count().toInt() - val lightTypeFace = ResourcesCompat.getFont(requireContext(), R.font.roboto_light) - val boldTypeFace = ResourcesCompat.getFont(requireContext(), R.font.roboto_bold) + try { // can crash for unknown reasons - if (lightTypeFace != null && boldTypeFace != null) { - ssb.setSpan(TypefaceSpan(lightTypeFace), 0, indexOfLastSpace, Spanned.SPAN_EXCLUSIVE_INCLUSIVE) - ssb.setSpan(TypefaceSpan(boldTypeFace), indexOfLastSpace, end, Spanned.SPAN_EXCLUSIVE_INCLUSIVE) + val end = upgradeString.chars().count().toInt() + val lightTypeFace = ResourcesCompat.getFont(requireContext(), R.font.roboto_light) + val boldTypeFace = ResourcesCompat.getFont(requireContext(), R.font.roboto_bold) + + if (lightTypeFace != null && boldTypeFace != null) { + ssb.setSpan(TypefaceSpan(lightTypeFace), 0, indexOfLastSpace, Spanned.SPAN_EXCLUSIVE_INCLUSIVE) + ssb.setSpan(TypefaceSpan(boldTypeFace), indexOfLastSpace, end, Spanned.SPAN_EXCLUSIVE_INCLUSIVE) + } + + } catch (e: Resources.NotFoundException) { + CrashLogging.log(e.message ?: "ResourcesCompat.getFont crashes somehow") } + } title.text = ssb