diff --git a/SUBasicUpdateDriver.m b/SUBasicUpdateDriver.m index 70ffb759..eb974c2d 100644 --- a/SUBasicUpdateDriver.m +++ b/SUBasicUpdateDriver.m @@ -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; }