Skip to content

Commit 7f151e9

Browse files
Added nil checks for URL string and parsed NSURL with early returns
1 parent 9f4fdaa commit 7f151e9

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

AppBox/AppDelegate.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,16 @@ -(void)openLatestLogFile {
179179

180180
//URISchem URL Handler
181181
-(void)handleGetURLWithEvent:(NSAppleEventDescriptor *)event andReply:(NSAppleEventDescriptor *)reply{
182-
NSURL *url = [NSURL URLWithString:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]];
182+
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
183+
if (!urlString || urlString.length == 0) {
184+
DDLogWarn(@"Received empty URL event");
185+
return;
186+
}
187+
NSURL *url = [NSURL URLWithString:urlString];
188+
if (!url) {
189+
DDLogWarn(@"Failed to parse URL: %@", urlString);
190+
return;
191+
}
183192
DDLogInfo(@"Handling URL = %@",url);
184193

185194
//Check for Dropbox auth

0 commit comments

Comments
 (0)