mirror of
https://github.com/transmission/transmission
synced 2025-02-01 03:43:43 +00:00
don't allow creation of torrent files with total size of zero bytes
This commit is contained in:
parent
b372ce45bf
commit
e18e9a706f
2 changed files with 17 additions and 0 deletions
|
@ -61,6 +61,7 @@
|
||||||
|
|
||||||
fPath = [path retain];
|
fPath = [path retain];
|
||||||
fInfo = tr_metaInfoBuilderCreate(handle, [fPath UTF8String]);
|
fInfo = tr_metaInfoBuilderCreate(handle, [fPath UTF8String]);
|
||||||
|
|
||||||
if (fInfo->fileCount == 0)
|
if (fInfo->fileCount == 0)
|
||||||
{
|
{
|
||||||
NSAlert * alert = [[NSAlert alloc] init];
|
NSAlert * alert = [[NSAlert alloc] init];
|
||||||
|
@ -77,6 +78,22 @@
|
||||||
[self release];
|
[self release];
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
if (fInfo->totalSize == 0)
|
||||||
|
{
|
||||||
|
NSAlert * alert = [[NSAlert alloc] init];
|
||||||
|
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Create torrent -> zero size -> button")];
|
||||||
|
[alert setMessageText: NSLocalizedString(@"The total file size is zero bytes.",
|
||||||
|
"Create torrent -> zero size -> title")];
|
||||||
|
[alert setInformativeText: NSLocalizedString(@"A torrent file cannot be created for files with no size.",
|
||||||
|
"Create torrent -> zero size -> warning")];
|
||||||
|
[alert setAlertStyle: NSWarningAlertStyle];
|
||||||
|
|
||||||
|
[alert runModal];
|
||||||
|
[alert release];
|
||||||
|
|
||||||
|
[self release];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
fDefaults = [NSUserDefaults standardUserDefaults];
|
fDefaults = [NSUserDefaults standardUserDefaults];
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue