Skip to content

Commit 4ea5058

Browse files
committed
Prevent NullPointerException crash when callbackInfo is null in BackgroundWorker
Fixes #527
1 parent b45313b commit 4ea5058

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • workmanager_android/android/src/main/kotlin/dev/fluttercommunity/workmanager

workmanager_android/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ class BackgroundWorker(
9090
) {
9191
val callbackHandle = SharedPreferenceHelper.getCallbackHandle(applicationContext)
9292
val callbackInfo = FlutterCallbackInformation.lookupCallbackInformation(callbackHandle)
93+
94+
if (callbackInfo == null) {
95+
Log.e(TAG, "Failed to resolve Dart callback for handle $callbackHandle.")
96+
return Result.failure()
97+
}
98+
9399
val dartBundlePath = flutterLoader.findAppBundlePath()
94100

95101
if (isInDebug) {

0 commit comments

Comments
 (0)