diff --git a/prefs/HBPackageNameHeaderCell.m b/prefs/HBPackageNameHeaderCell.m index 688c1c6..411ee77 100644 --- a/prefs/HBPackageNameHeaderCell.m +++ b/prefs/HBPackageNameHeaderCell.m @@ -79,7 +79,13 @@ - (CGFloat)preferredHeightForWidth:(CGFloat)width { - (void)updateData { [self _retrievePackageDetails]; - if (![self.textLabel respondsToSelector:@selector(setAttributedText:)]) { // starting to realise the features we take for granted these days... + if ([_packageDetails.allValues containsObject:@""]) { + // i hate pirate repos + return; + } + + if (![self.textLabel respondsToSelector:@selector(setAttributedText:)]) { + // starting to realise the features we take for granted these days... self.textLabel.text = [NSString stringWithFormat:@"%@%@%@", _packageDetails[kHBDebianControlFileNameKey], _showVersion ? @" " : @"", _showVersion ? _packageDetails[kHBDebianControlFileVersionKey] : @""]; return; } @@ -154,11 +160,12 @@ - (void)_retrievePackageDetails { NSArray *packageData = [HBOutputForShellCommand([NSString stringWithFormat:@"/usr/bin/dpkg-query -f '${Name}\n==libcephei-divider==\n${Version}\n==libcephei-divider==\n${Author}' -W '%@'", identifier]) componentsSeparatedByString:@"\n==libcephei-divider==\n"]; [_packageDetails release]; + _packageDetails = [@{ kHBDebianControlFilePackageKey: identifier, - kHBDebianControlFileNameKey: packageData[0], - kHBDebianControlFileVersionKey: packageData[1], - kHBDebianControlFileAuthorKey: packageData[2], + kHBDebianControlFileNameKey: packageData[0] ?: @"", + kHBDebianControlFileVersionKey: packageData[1] ?: @"", + kHBDebianControlFileAuthorKey: packageData[2] ?: @"", } retain]; }