Skip to content

Commit e565075

Browse files
committed
fix: crash when mapping a non-existing CtaId
1 parent bb3ae55 commit e565075

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/src/main/java/com/duckduckgo/app/cta/model/DismissedCta.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ enum class CtaId {
3131
DAX_DIALOG_OTHER,
3232
DAX_END,
3333
USE_OUR_APP,
34-
USE_OUR_APP_DELETION
34+
USE_OUR_APP_DELETION,
35+
UNKNOWN
3536
}
3637

3738
@Entity(
@@ -46,7 +47,11 @@ data class DismissedCta(
4647

4748
@TypeConverter
4849
fun toId(value: String): CtaId {
49-
return CtaId.valueOf(value)
50+
return try {
51+
CtaId.valueOf(value)
52+
} catch (ex: IllegalArgumentException) {
53+
CtaId.UNKNOWN;
54+
}
5055
}
5156

5257
@TypeConverter

0 commit comments

Comments
 (0)