From c7125ec291c4e03df527fb2b32b4b95e72fe36d4 Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Thu, 23 Mar 2023 21:38:46 +0000 Subject: [PATCH] Fix for github bug #289 --- ChangeLog | 4 ++++ Source/NSTimer.m | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c806f235a..b9d8dc9ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2022-03-23 Richard Frith-Macdonald + + * Source/NSTimer.m: wrap call to block in exception handler (bug #289) + 2023-01-13 Frederik Seiffert * Source/Additions/GSInsensitiveDictionary.m: diff --git a/Source/NSTimer.m b/Source/NSTimer.m index 82dd279f3..1444f46c2 100644 --- a/Source/NSTimer.m +++ b/Source/NSTimer.m @@ -290,7 +290,17 @@ static Class NSDate_class; { if ((id)_block != nil) { - CALL_NON_NULL_BLOCK(_block, self); + NS_DURING + { + CALL_NON_NULL_BLOCK(_block, self); + } + NS_HANDLER + { + NSLog(@"*** NSTimer ignoring exception '%@' (reason '%@') " + @"raised during posting of timer with block", + [localException name], [localException reason]); + } + NS_ENDHANDLER } else {