From af5d50ffd36368239c9111cb545e872f95fbb27d Mon Sep 17 00:00:00 2001 From: systemBlue Date: Tue, 2 Jun 2026 18:40:27 -0400 Subject: [PATCH] fix: don't crash background notification poll on an invalid instance URL buildRequest force-unwrapped URLComponents(string:) built from the user-entered server URL, so a value that doesn't parse as a URL crashed the background refresh task. Guard it and return nil, matching the keychain failure path already in this method. Co-Authored-By: Claude Opus 4.8 (1M context) --- Forji/Forji/Services/BackgroundDownloadManager.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Forji/Forji/Services/BackgroundDownloadManager.swift b/Forji/Forji/Services/BackgroundDownloadManager.swift index 2699203..c7dfd6d 100644 --- a/Forji/Forji/Services/BackgroundDownloadManager.swift +++ b/Forji/Forji/Services/BackgroundDownloadManager.swift @@ -87,7 +87,9 @@ final class BackgroundDownloadManager: NSObject, Sendable { for: instance.serverURL, username: instance.username, ) else { return nil } - var components = URLComponents(string: "\(instance.serverURL)/api/v1/notifications")! + guard var components = URLComponents(string: "\(instance.serverURL)/api/v1/notifications") else { + return nil + } components.queryItems = [ URLQueryItem(name: "status-types", value: "unread"), URLQueryItem(name: "page", value: "1"),