From 063974c5537aba2c03aec74336b620ada0b3a131 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 25 Apr 2021 14:28:33 -0700 Subject: [PATCH] Simplify logic in -preferredUpdateForRegularAppcastItem method --- Sparkle/SUAppcastDriver.m | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Sparkle/SUAppcastDriver.m b/Sparkle/SUAppcastDriver.m index 44101dad..64366002 100644 --- a/Sparkle/SUAppcastDriver.m +++ b/Sparkle/SUAppcastDriver.m @@ -69,14 +69,7 @@ - (SUAppcastItem * _Nullable)preferredUpdateForRegularAppcastItem:(SUAppcastItem * _Nullable)regularItem secondaryUpdate:(SUAppcastItem * __autoreleasing _Nullable *)secondaryUpdate { - if (regularItem == nil) { - if (secondaryUpdate != NULL) { - *secondaryUpdate = nil; - } - return nil; - } - - SUAppcastItem *deltaItem = [[self class] deltaUpdateFromAppcastItem:regularItem hostVersion:self.host.version]; + SUAppcastItem *deltaItem = (regularItem != nil) ? [[self class] deltaUpdateFromAppcastItem:regularItem hostVersion:self.host.version] : nil; if (deltaItem != nil) { if (secondaryUpdate != NULL) { @@ -84,6 +77,9 @@ } return deltaItem; } else { + if (secondaryUpdate != NULL) { + *secondaryUpdate = nil; + } return regularItem; } }