From 4577328cb094c9348a534df2d9f6e4ba977dac62 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 13 Jun 2020 11:51:53 -0400 Subject: [PATCH] Speculative fix for a crash if a handler cannot be found for a transaction. Reported https://groups.google.com/d/msg/bluestatic/6NLJFmbEElg/hFtsRDX0CAAJ Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 org.bluestatic.macgdbp 0x000000010cc0a316 -[ProtocolClient messageQueue:didReceiveMessage:] + 794 1 com.apple.CoreFoundation 0x00007fff34763a6c __invoking___ + 140 2 com.apple.CoreFoundation 0x00007fff34763911 -[NSInvocation invoke] + 303 3 com.apple.CoreFoundation 0x00007fff34796eea -[NSInvocation invokeWithTarget:] + 70 4 org.bluestatic.macgdbp 0x000000010cc0ab80 -[BSProtocolThreadInvoker dispatchInvocation:] + 123 5 com.apple.Foundation 0x00007fff36e4f1bd __NSThreadPerformPerform + 204 6 com.apple.CoreFoundation 0x00007fff34781f12 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 7 com.apple.CoreFoundation 0x00007fff34781eb1 __CFRunLoopDoSource0 + 103 8 com.apple.CoreFoundation 0x00007fff34781ccb __CFRunLoopDoSources0 + 209 9 com.apple.CoreFoundation 0x00007fff347809fa __CFRunLoopRun + 927 10 com.apple.CoreFoundation 0x00007fff3477fffe CFRunLoopRunSpecific + 462 11 com.apple.HIToolbox 0x00007fff333b3abd RunCurrentEventLoopInMode + 292 12 com.apple.HIToolbox 0x00007fff333b37d5 ReceiveNextEventCommon + 584 13 com.apple.HIToolbox 0x00007fff333b3579 _BlockUntilNextEventMatchingListInModeWithFilter + 64 14 com.apple.AppKit 0x00007fff319fec99 _DPSNextEvent + 883 15 com.apple.AppKit 0x00007fff319fd4e0 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352 16 com.apple.AppKit 0x00007fff319ef1ee -[NSApplication run] + 658 17 com.apple.AppKit 0x00007fff319c0ff6 NSApplicationMain + 777 18 libdyld.dylib 0x00007fff6e6c8cc9 start + 1 --- CHANGES | 1 + Source/ProtocolClient.m | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index 286f7f8..8d5432a 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ MacGDBp CHANGE LOG ##################### - Fix: #265 Variables holding scalars would not display a value. - Change: Reorganized the Window main menu. +- Fix: Speculative fix for a crash when connecting. 2.0.2 ##################### diff --git a/Source/ProtocolClient.m b/Source/ProtocolClient.m index 537906e..99baa7e 100644 --- a/Source/ProtocolClient.m +++ b/Source/ProtocolClient.m @@ -201,6 +201,10 @@ } else { // Dispatch the handler for the message. ProtocolClientMessageHandler handler = [_dispatchTable objectForKey:@(transactionID)]; + if (!handler) { + NSLog(@"Could not dispatch handler for transaction %ld: %@", transactionID, message); + return; + } handler(xml); [_dispatchTable removeObjectForKey:@(transactionID)]; } -- 2.22.5