From 2297a72e29b0458d79085f32da1d240763e79778 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 7 Jan 2026 15:53:23 +0000 Subject: [PATCH] Clear service variable when onCreate() fails to start foreground service Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com> --- .../thoughtcrime/securesms/service/FetchForegroundService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/thoughtcrime/securesms/service/FetchForegroundService.java b/src/main/java/org/thoughtcrime/securesms/service/FetchForegroundService.java index 3d6673109..4777e85fc 100644 --- a/src/main/java/org/thoughtcrime/securesms/service/FetchForegroundService.java +++ b/src/main/java/org/thoughtcrime/securesms/service/FetchForegroundService.java @@ -92,6 +92,9 @@ public final class FetchForegroundService extends Service { startForeground(NotificationCenter.ID_FETCH, notification); } catch (Exception e) { Log.w(TAG, "Failed to start foreground service", e); + synchronized (SERVICE_LOCK) { + service = null; + } stopSelf(); return; }