Skip to content

Commit dc78d84

Browse files
Swallow potential foreground service crash.
1 parent 886bebb commit dc78d84

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/src/main/java/org/thoughtcrime/securesms/gcm/FcmFetchForegroundService.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ class FcmFetchForegroundService : Service() {
123123

124124
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
125125
Log.d(TAG, "onStartCommand()")
126-
postForegroundNotification()
126+
try {
127+
postForegroundNotification()
128+
} catch (e: RuntimeException) {
129+
Log.w(TAG, "Failed to start foreground service! StopSelf: ${intent?.getBooleanExtra(KEY_STOP_SELF, false)}", e)
130+
}
127131

128132
return if (intent != null && intent.getBooleanExtra(KEY_STOP_SELF, false)) {
129133
WakeLockUtil.release(wakeLock, WAKELOCK_TAG)

0 commit comments

Comments
 (0)