We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 15b2688 commit 4f848b8Copy full SHA for 4f848b8
androidshared/src/main/java/org/odk/collect/androidshared/data/AppState.kt
@@ -62,8 +62,12 @@ interface StateStore {
62
}
63
64
fun Application.getState(): AppState {
65
- val stateStore = this as StateStore
66
- return stateStore.getState()
+ try {
+ val stateStore = this as StateStore
67
+ return stateStore.getState()
68
+ } catch (e: ClassCastException) {
69
+ throw ClassCastException("${this.javaClass} cannot be cast to StateStore")
70
+ }
71
72
73
fun Context.getState(): AppState {
0 commit comments