diff --git a/Sparkle/SPUUpdaterDelegate.h b/Sparkle/SPUUpdaterDelegate.h index 6aaaab25..780185f2 100644 --- a/Sparkle/SPUUpdaterDelegate.h +++ b/Sparkle/SPUUpdaterDelegate.h @@ -172,6 +172,10 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck) Also do not return a non-top level item from the appcast such as a delta item. Delta items will be ignored. Sparkle picks the delta item from your selection if the appropriate one is available. + This method will not be invoked with an appcast that has zero items. Pick the best item from the appcast. + If an item is available that has the same version as the application or bundle to update, + do not pick an item that is worse than that version. + This method may be called multiple times for different selections and filters. This method should be efficient. \param appcast The appcast that was downloaded from the remote server. diff --git a/Sparkle/SUAppcastDriver.m b/Sparkle/SUAppcastDriver.m index 76103915..2613bfab 100644 --- a/Sparkle/SUAppcastDriver.m +++ b/Sparkle/SUAppcastDriver.m @@ -120,8 +120,9 @@ - (SUAppcastItem *)retrieveBestAppcastItemFromAppcast:(SUAppcast *)appcast versionComparator:(id)versionComparator secondaryUpdate:(SUAppcastItem * __autoreleasing _Nullable *)secondaryAppcastItem { // Find the best valid update in the appcast by asking the delegate + // Don't ask the delegate if the appcast has no items though SUAppcastItem *regularItemFromDelegate; - if ([self.updaterDelegate respondsToSelector:@selector((bestValidUpdateInAppcast:forUpdater:))]) { + if (appcast.items.count > 0 && [self.updaterDelegate respondsToSelector:@selector((bestValidUpdateInAppcast:forUpdater:))]) { SUAppcastItem *candidateItem = [self.updaterDelegate bestValidUpdateInAppcast:appcast forUpdater:(id _Nonnull)self.updater]; assert(!candidateItem.deltaUpdate);