From 1ba8ba9e5891130459ed5999e73c525abe8128af Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 27 May 2016 15:29:33 -0400 Subject: [PATCH] (fix) avoid crashing due to bogus URLs (GNUstep braindamage) --- SOPE/NGCards/iCalEntityObject.m | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/SOPE/NGCards/iCalEntityObject.m b/SOPE/NGCards/iCalEntityObject.m index 02456866e..b61b96cca 100644 --- a/SOPE/NGCards/iCalEntityObject.m +++ b/SOPE/NGCards/iCalEntityObject.m @@ -20,6 +20,7 @@ */ #import +#import #import #import @@ -436,12 +437,21 @@ for (count = 0; count < max; count++) { stringAttach = [[elements objectAtIndex: count] flattenedValuesForKey: @""]; - url = [NSURL URLWithString: stringAttach]; - if (![url scheme] && [stringAttach length] > 0) - url = [NSURL URLWithString: [NSString stringWithFormat: @"http://%@", stringAttach]]; + NS_DURING + { + url = [NSURL URLWithString: stringAttach]; - [attachUrls addObject: [url absoluteString]]; + if (![url scheme] && [stringAttach length] > 0) + url = [NSURL URLWithString: [NSString stringWithFormat: @"http://%@", stringAttach]]; + + [attachUrls addObject: [url absoluteString]]; + } + NS_HANDLER + { + // Invalid URL, skipping. + } + NS_ENDHANDLER } return attachUrls;