From 4f6803cc03e773a64efed946b5449324a9bf772d Mon Sep 17 00:00:00 2001 From: systemBlue Date: Thu, 4 Jun 2026 13:00:25 +0200 Subject: [PATCH] fix: don't crash the background notification poll on an invalid instance URL (#54) --- 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"),