From 683e7794a38bb4b03203773bf4d88a88d5fb8f22 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 12 May 2022 11:50:03 +0200 Subject: [PATCH] Fix crashing of finder sync extension caused by dispatch_source_cancel of nullptr Signed-off-by: Claudio Cambra --- .../FinderSyncExt/LocalSocketClient.m | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/LocalSocketClient.m b/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/LocalSocketClient.m index ad3cc1cde..fb3c37638 100644 --- a/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/LocalSocketClient.m +++ b/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/LocalSocketClient.m @@ -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];