Fix crashing of finder sync extension caused by dispatch_source_cancel of nullptr

Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
This commit is contained in:
Claudio Cambra 2022-05-12 11:50:03 +02:00
parent 85d8128021
commit 683e7794a3

View file

@ -137,10 +137,17 @@
- (void)closeConnection
{
NSLog(@"Closing connection.");
dispatch_source_cancel(self.readSource);
dispatch_source_cancel(self.writeSource);
self.readSource = nil;
self.writeSource = nil;
if(self.readSource) {
dispatch_source_cancel(self.readSource);
self.readSource = nil;
}
if(self.writeSource) {
dispatch_source_cancel(self.writeSource);
self.writeSource = nil;
}
[self.inBuffer setLength:0];
[self.outBuffer setLength: 0];