Fixes crash when attempting to use invalid clipboard image when changing game artwork

This commit is contained in:
Riley Testut 2017-12-21 15:39:35 -06:00
parent a371bb71a9
commit 5939e20399
2 changed files with 8 additions and 10 deletions

View File

@ -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

2
External/Roxas vendored

@ -1 +1 @@
Subproject commit 902035729a2d93099f07d63af2f77f6e326ebfec
Subproject commit 97b3a7ab05ee320d3c96eadc3cc69c38d10ec206