fix: crash in torrent rename dialog after torrent removal (#8425)

This commit is contained in:
Charles Kerr
2026-02-14 14:44:31 -06:00
committed by GitHub
parent 45308e8d7d
commit a37ca2a090

View File

@@ -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];