1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-30 19:46:56 +00:00

patch from beelsebob to fix crash with connected peers with no client name

This commit is contained in:
Mitchell Livingston 2007-09-27 12:44:25 +00:00
parent d3077bbce1
commit 04f6e208b9

View file

@ -970,8 +970,8 @@ static int static_lastid = 0;
} }
- (float) progressLeft - (float) progressLeft
{ {//NSLog(@"left %f",(float)fStat->leftUntilDone / [self size]);
return (float)fStat->leftUntilDone/[self size]; return (float)fStat->leftUntilDone / [self size];
} }
- (int) eta - (int) eta
@ -979,6 +979,11 @@ static int static_lastid = 0;
return fStat->eta; return fStat->eta;
} }
/*- (float) notAvailableDesired
{NSLog(@"not available %f", (float)(fStat->desiredSize - fStat->desiredAvailable) / [self size]);
return (float)(fStat->desiredSize - fStat->desiredAvailable) / [self size];
}*/
- (BOOL) isActive - (BOOL) isActive
{ {
return fStat->status & TR_STATUS_ACTIVE; return fStat->status & TR_STATUS_ACTIVE;
@ -1056,9 +1061,11 @@ static int static_lastid = 0;
[dic setObject: [NSNumber numberWithFloat: peer->downloadFromRate] forKey: @"DL From Rate"]; [dic setObject: [NSNumber numberWithFloat: peer->downloadFromRate] forKey: @"DL From Rate"];
[dic setObject: [NSNumber numberWithBool: peer->isEncrypted] forKey: @"Encryption"]; [dic setObject: [NSNumber numberWithBool: peer->isEncrypted] forKey: @"Encryption"];
[dic setObject: [NSString stringWithCString: (char *) peer->client encoding: NSUTF8StringEncoding] forKey: @"Client"];
} }
#warning why would connected clients have null value?
if (peer->client)
[dic setObject: [NSString stringWithCString: (char *) peer->client encoding: NSUTF8StringEncoding] forKey: @"Client"];
else else
[dic setObject: @"" forKey: @"Client"]; //needed to be set here for client sort [dic setObject: @"" forKey: @"Client"]; //needed to be set here for client sort