Skip to content
Permalink
Browse files

Fix crash when artwork data cant be transformed into uiimage

  • Loading branch information...
GianniCarlo committed Jun 26, 2019
1 parent 3a022a3 commit 2643962ed03edf251bac16c2ebefb2819a694990
@@ -375,7 +375,7 @@ extension LibraryViewController {
}
let nextIndex = forward ? currentIndex + 1 : currentIndex - 1

while nextIndex >= 0 && nextIndex < playListCells.count {
while nextIndex >= 0, nextIndex < playListCells.count {
let cell = playListCells[nextIndex]
return UIAccessibilityCustomRotorItemResult(targetElement: cell, targetRange: nil)
}
@@ -408,9 +408,9 @@ extension UIColor {
h_p_bar = h_1_p + h_2_p
} else if abs(h_1_p - h_2_p) <= 180 {
h_p_bar = (h_1_p + h_2_p) / 2
} else if abs(h_1_p - h_2_p) > 180 && (h_1_p + h_2_p) < 360 {
} else if abs(h_1_p - h_2_p) > 180, (h_1_p + h_2_p) < 360 {
h_p_bar = (h_1_p + h_2_p + 360) / 2
} else if abs(h_1_p - h_2_p) > 180 && (h_1_p + h_2_p) >= 360 {
} else if abs(h_1_p - h_2_p) > 180, (h_1_p + h_2_p) >= 360 {
h_p_bar = (h_1_p + h_2_p - 360) / 2
}

@@ -18,11 +18,12 @@ public class LibraryItem: NSManagedObject, Codable {
return cachedArtwork
}

guard let artworkData = self.artworkData else {
guard let artworkData = self.artworkData,
let image = UIImage(data: artworkData as Data) else {
return #imageLiteral(resourceName: "defaultArtwork")
}

self.cachedArtwork = UIImage(data: artworkData as Data)
self.cachedArtwork = image
return self.cachedArtwork!
}

@@ -24,7 +24,7 @@ public class WatchConnectivityService: NSObject, WCSessionDelegate {
// consider prompting the user to install it for a better experience
#if os(iOS)
if let session = self.session, session.isPaired && session.isWatchAppInstalled {
if let session = self.session, session.isPaired, session.isWatchAppInstalled {
return session
} else {
return nil

0 comments on commit 2643962

Please sign in to comment.
You can’t perform that action at this time.