diff --git a/acra-limiter/src/main/java/org/acra/startup/LimiterStartupProcessor.kt b/acra-limiter/src/main/java/org/acra/startup/LimiterStartupProcessor.kt index 149a45c6ca..d3bb344194 100644 --- a/acra-limiter/src/main/java/org/acra/startup/LimiterStartupProcessor.kt +++ b/acra-limiter/src/main/java/org/acra/startup/LimiterStartupProcessor.kt @@ -40,9 +40,13 @@ class LimiterStartupProcessor : HasConfigPlugin(LimiterConfiguration::class.java if (limiterConfiguration.deleteReportsOnAppUpdate || limiterConfiguration.resetLimitsOnAppUpdate) { val prefs = SharedPreferencesFactory(context, config).create() val lastVersionNr = try { - prefs.getLong(ACRA.PREF_LAST_VERSION_NR, 0) - } catch (e: ClassCastException) { - prefs.getInt(ACRA.PREF_LAST_VERSION_NR, 0).toLong() + try { + prefs.getLong(ACRA.PREF_LAST_VERSION_NR, 0) + } catch (e: ClassCastException) { + prefs.getInt(ACRA.PREF_LAST_VERSION_NR, 0).toLong() + } + } catch (e: Exception) { + 0 } val appVersion = getAppVersion(context) if (appVersion > lastVersionNr) {