diff --git a/ChangeLog b/ChangeLog index dd19dd97f..9e420bc69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-03-25 Richard Frith-Macdonald + + * Source/NSURL.m: When loading a resource and attempting to notify + a client, check that the client responds to the selectors before + sending messages to it. + 2003-03-25 David Ayers * Headers/gnustep/base/GSObjCRuntime.h diff --git a/Source/NSURL.m b/Source/NSURL.m index 7807bc4f0..b8d519eaf 100644 --- a/Source/NSURL.m +++ b/Source/NSURL.m @@ -1514,14 +1514,23 @@ static void unescape(const char *from, char * to) - (void) URLHandle: (NSURLHandle*)sender resourceDataDidBecomeAvailable: (NSData*)newData { - [clientForHandle(_clients, sender) URL: self - resourceDataDidBecomeAvailable: newData]; + id c = clientForHandle(_clients, sender); + + if ([c respondsToSelector: @selector(URL:resourceDataDidBecomeAvailable:)]) + { + [c URL: self resourceDataDidBecomeAvailable: newData]; + } } + - (void) URLHandle: (NSURLHandle*)sender resourceDidFailLoadingWithReason: (NSString*)reason { - [clientForHandle(_clients, sender) URL: self - resourceDidFailLoadingWithReason: reason]; + id c = clientForHandle(_clients, sender); + + if ([c respondsToSelector: @selector(URL:resourceDidFailLoadingWithReason:)]) + { + [c URL: self resourceDidFailLoadingWithReason: reason]; + } } - (void) URLHandleResourceDidBeginLoading: (NSURLHandle*)sender @@ -1530,12 +1539,22 @@ static void unescape(const char *from, char * to) - (void) URLHandleResourceDidCancelLoading: (NSURLHandle*)sender { - [clientForHandle(_clients, sender) URLResourceDidCancelLoading: self]; + id c = clientForHandle(_clients, sender); + + if ([c respondsToSelector: @selector(URLResourceDidCancelLoading:)]) + { + [c URLResourceDidCancelLoading: self]; + } } - (void) URLHandleResourceDidFinishLoading: (NSURLHandle*)sender { - [clientForHandle(_clients, sender) URLResourceDidFinishLoading: self]; + id c = clientForHandle(_clients, sender); + + if ([c respondsToSelector: @selector(URLResourceDidFinishLoading:g:)]) + { + [c URLResourceDidFinishLoading: self]; + } }