Fix throwing nil exceptions.

main
Niels Grewe 10 years ago
parent b0fba94d8b
commit b2e7c50704

@ -26,6 +26,7 @@ set(TESTS
WeakReferences_arc.m WeakReferences_arc.m
objc_msgSend.m objc_msgSend.m
msgInterpose.m msgInterpose.m
NilException.m
) )
# Function for adding a test. This takes the name of the test and the list of # Function for adding a test. This takes the name of the test and the list of

@ -0,0 +1,17 @@
#include "Test.h"
int main(void)
{
BOOL caught_exception = NO;
@try
{
@throw(nil);
}
@catch (id x)
{
assert(nil == x);
caught_exception = YES;
}
assert(caught_exception == YES);
return 0;
}

@ -358,7 +358,10 @@ static inline _Unwind_Reason_Code internal_objc_personality(int version,
else if (!foreignException) else if (!foreignException)
{ {
ex = objc_exception_from_header(exceptionObject); ex = objc_exception_from_header(exceptionObject);
thrown_class = classForObject(ex->object); if (ex->object != nil)
{
thrown_class = classForObject(ex->object);
}
} }
else if (_objc_class_for_boxing_foreign_exception) else if (_objc_class_for_boxing_foreign_exception)
{ {

Loading…
Cancel
Save