diff --git a/shared/src/main/java/info/nightscout/shared/weardata/EventData.kt b/shared/src/main/java/info/nightscout/shared/weardata/EventData.kt index aca2303c89..fd30835155 100644 --- a/shared/src/main/java/info/nightscout/shared/weardata/EventData.kt +++ b/shared/src/main/java/info/nightscout/shared/weardata/EventData.kt @@ -14,7 +14,11 @@ sealed class EventData : Event() { companion object { - fun deserialize(json: String) = Json.decodeFromString(serializer(), json) + fun deserialize(json: String) = try { + Json.decodeFromString(serializer(), json) + } catch (ignored: Exception) { + Error(System.currentTimeMillis()) + } } // Mobile <- Wear @@ -234,7 +238,7 @@ sealed class EventData : Event() { @Serializable // returnCommand is sent back to Mobile after confirmation data class ConfirmAction(val title: String, val message: String, val returnCommand: EventData?) : EventData() - + @Serializable data class SnoozeAlert(val timeStamp: Long) : EventData() }