Skip to content

Commit 7c29570

Browse files
committed
Use loadObject instead of existingObject(with:)
So that we can catch an `NSInvalidArgumentException` Objective-C exception. See #20630
1 parent 0a1829d commit 7c29570

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

WordPress/Classes/ViewRelated/Gutenberg/EditorMediaUtility.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class AuthenticatedImageDownload: AsyncOperation {
3131
throw DownloadError.blogNotFound
3232
}
3333

34-
let blog = try context.existingObject(with: self.blogObjectID) as! Blog
34+
let blog = try context.loadObject(ofType: Blog.self, with: self.blogObjectID)
3535
return MediaHost(with: blog) { error in
3636
// We'll log the error, so we know it's there, but we won't halt execution.
3737
WordPressAppDelegate.crashLogging?.logError(error)

0 commit comments

Comments
 (0)