Commit cb70da00 by Armel Soro Committed by GitHub

Safely call 'cancel' even if lateinit property 'mToast' had not been initialized beforehand (#231)

This covers cases where we call 'cancel' the very first time,
even if no Toast had ever been displayed beforehand.
parent 21baaeaf
...@@ -83,7 +83,9 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler { ...@@ -83,7 +83,9 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
result.success(true) result.success(true)
} }
"cancel" -> { "cancel" -> {
if (::mToast.isInitialized) {
mToast.cancel() mToast.cancel()
}
result.success(true) result.success(true)
} }
else -> result.notImplemented() else -> result.notImplemented()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment