From 788e21c4ea12d83f1013e1e6fd49e987e86c188e Mon Sep 17 00:00:00 2001 From: jack Date: Thu, 25 Sep 2025 14:00:15 +0200 Subject: [PATCH] Fix CFMutableData handling --- bitchat/Features/media/ImageUtils.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bitchat/Features/media/ImageUtils.swift b/bitchat/Features/media/ImageUtils.swift index c1f48e11..2d375699 100644 --- a/bitchat/Features/media/ImageUtils.swift +++ b/bitchat/Features/media/ImageUtils.swift @@ -111,7 +111,9 @@ enum ImageUtils { } private static func encodeJPEG(from cgImage: CGImage, quality: CGFloat) -> Data? { - let data = CFDataCreateMutable(nil, 0) + guard let data = CFDataCreateMutable(nil, 0) else { + return nil + } guard let destination = CGImageDestinationCreateWithData(data, UTType.jpeg.identifier as CFString, 1, nil) else { return nil }