mirror of
https://github.com/transmission/transmission.git
synced 2026-02-14 23:19:34 +00:00
fix: crash in torrent rename dialog after torrent removal (#8425)
This commit is contained in:
@@ -196,6 +196,7 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error* error)
|
||||
[self setTimeMachineExclude:NO];
|
||||
|
||||
tr_torrentRemove(self.fHandle, trashFiles, trashDataFile, nullptr);
|
||||
_fHandle = nullptr;
|
||||
}
|
||||
|
||||
- (void)changeDownloadFolderBeforeUsing:(NSString*)folder determinationType:(TorrentDeterminationType)determinationType
|
||||
@@ -821,6 +822,15 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error* error)
|
||||
NSParameterAssert(newName != nil);
|
||||
NSParameterAssert(![newName isEqualToString:@""]);
|
||||
|
||||
if (self.fHandle == nullptr)
|
||||
{
|
||||
if (completionHandler != nullptr)
|
||||
{
|
||||
completionHandler(NO);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
NSDictionary* contextInfo = @{ @"Torrent" : self, @"CompletionHandler" : [completionHandler copy] };
|
||||
|
||||
tr_torrentRenamePath(self.fHandle, tr_torrentName(self.fHandle), newName.UTF8String, renameCallback, (__bridge_retained void*)(contextInfo));
|
||||
@@ -834,6 +844,15 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error* error)
|
||||
NSParameterAssert(newName != nil);
|
||||
NSParameterAssert(![newName isEqualToString:@""]);
|
||||
|
||||
if (self.fHandle == nullptr)
|
||||
{
|
||||
if (completionHandler != nullptr)
|
||||
{
|
||||
completionHandler(NO);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
NSDictionary* contextInfo = @{ @"Torrent" : self, @"Nodes" : @[ node ], @"CompletionHandler" : [completionHandler copy] };
|
||||
|
||||
NSString* oldPath = [node.path stringByAppendingPathComponent:node.name];
|
||||
|
||||
Reference in New Issue
Block a user