More fixes for 258060

Fixes a bug which could cause a crash when the update item is chosen by the delegate from the appcast. Thanks, Christiaan Hofman.
This commit is contained in:
Andy Matuschak committed 2008-09-03 22:34:25 -05:00
1 parent 74b206dc77
commit d201803259
1 file changed
+8 -6
+8 -6
View File
@@ -79,22 +79,24 @@
{
if ([[updater delegate] respondsToSelector:@selector(updater:didFinishLoadingAppcast:)])
[[updater delegate] updater:updater didFinishLoadingAppcast:ac];
SUAppcastItem *item = nil;
// Now we have to find the best valid update in the appcast.
if ([[updater delegate] respondsToSelector:@selector(bestValidUpdateInAppcast:forUpdater:)]) // Does the delegate want to handle it?
{
updateItem = [[updater delegate] bestValidUpdateInAppcast:ac forUpdater:updater];
item = [[updater delegate] bestValidUpdateInAppcast:ac forUpdater:updater];
}
else // If not, we'll take care of it ourselves.
{
// Find the first update we can actually use.
NSEnumerator *updateEnumerator = [[ac items] objectEnumerator];
do {
updateItem = [updateEnumerator nextObject];
} while (updateItem && ![self hostSupportsItem:updateItem]);
[updateItem retain];
item = [updateEnumerator nextObject];
} while (item && ![self hostSupportsItem:item]);
}
updateItem = [item retain];
CFRelease(ac); // Remember that we're explicitly managing the memory of the appcast.
if (updateItem == nil) { [self didNotFindUpdate]; return; }