Skip to content

Commit

Permalink
fix(mobile): background task crashing on Android (immich-app#12314)
Browse files Browse the repository at this point in the history
  • Loading branch information
alextran1502 authored Sep 5, 2024
1 parent f4ec842 commit f26d47c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ class BackupWorker(ctx: Context, params: WorkerParameters) : ListenableWorker(ct
// called when the system has to stop this worker because constraints are
// no longer met or the system needs resources for more important tasks
Handler(Looper.getMainLooper()).postAtFrontOfQueue {
backgroundChannel.invokeMethod("systemStop", null)
if (::backgroundChannel.isInitialized) {
backgroundChannel.invokeMethod("systemStop", null)
}
}
waitOnSetForegroundAsync()
// cannot await/get(block) on resolvableFuture as its already cancelled (would throw CancellationException)
Expand Down

0 comments on commit f26d47c

Please sign in to comment.