From 5939e203998e540d6b6532fa161e3cf95da45120 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 21 Dec 2017 15:39:35 -0600 Subject: [PATCH] Fixes crash when attempting to use invalid clipboard image when changing game artwork --- .../GameCollectionViewController.swift | 16 +++++++--------- External/Roxas | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Delta/Game Selection/GameCollectionViewController.swift b/Delta/Game Selection/GameCollectionViewController.swift index 68f3112..f7e53c5 100644 --- a/Delta/Game Selection/GameCollectionViewController.swift +++ b/Delta/Game Selection/GameCollectionViewController.swift @@ -526,17 +526,15 @@ extension GameCollectionViewController: ImportControllerDelegate { let imageData = try Data(contentsOf: url) - if let image = UIImage(data: imageData) + if + let image = UIImage(data: imageData), + let resizedImage = image.resizing(toFit: CGSize(width: 300, height: 300)), + let resizedData = UIImageJPEGRepresentation(resizedImage, 0.85) { - let resizedImage = image.resizing(toFit: CGSize(width: 300, height: 300)) + let destinationURL = DatabaseManager.artworkURL(for: game) + try resizedData.write(to: destinationURL, options: .atomic) - if let resizedData = UIImageJPEGRepresentation(resizedImage, 0.85) - { - let destinationURL = DatabaseManager.artworkURL(for: game) - try resizedData.write(to: destinationURL, options: .atomic) - - imageURL = destinationURL - } + imageURL = destinationURL } } catch diff --git a/External/Roxas b/External/Roxas index 9020357..97b3a7a 160000 --- a/External/Roxas +++ b/External/Roxas @@ -1 +1 @@ -Subproject commit 902035729a2d93099f07d63af2f77f6e326ebfec +Subproject commit 97b3a7ab05ee320d3c96eadc3cc69c38d10ec206