diff options
author | Damiano Galassi <[email protected]> | 2019-04-01 11:46:25 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2019-04-01 11:46:25 +0200 |
commit | 97e1f39d8427f3d18a29dd3214283f1828972a34 (patch) | |
tree | c6fd21b5cfe1072125c462ec9134be066f442931 /macosx | |
parent | 833c05dae403b3c92efc592e1702f149f58ae48a (diff) |
MacGui: don't allow empty output file names.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/HBJob.m | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/macosx/HBJob.m b/macosx/HBJob.m index ebd8df594..ce92ed4bc 100644 --- a/macosx/HBJob.m +++ b/macosx/HBJob.m @@ -177,6 +177,25 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; } return NO; } + if (value.length == 0) + { + if (outError) + { + *outError = [NSError errorWithDomain:@"HBError" code:0 userInfo:@{NSLocalizedDescriptionKey: HBKitLocalizedString(@"Invalid name", @"HBJob -> invalid name error description"), + NSLocalizedRecoverySuggestionErrorKey: HBKitLocalizedString(@"The file name can't be empty.", @"HBJob -> invalid name error recovery suggestion")}]; + } + return NO; + } + } + + if (*ioValue == nil) + { + if (outError) + { + *outError = [NSError errorWithDomain:@"HBError" code:0 userInfo:@{NSLocalizedDescriptionKey: HBKitLocalizedString(@"Invalid name", @"HBJob -> invalid name error description"), + NSLocalizedRecoverySuggestionErrorKey: HBKitLocalizedString(@"The file name can't be empty.", @"HBJob -> invalid name error recovery suggestion")}]; + } + return NO; } return retval; |