mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Analyzer warning fixes for situations where a parameter might be nil.
This commit is contained in:
1 parent
ec146a9828
commit
2028b5699a
2 files changed
+20
-16
No files matched your search
@@ -164,9 +164,11 @@
|
||||
|
||||
- (void)downloadUpdate
|
||||
{
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[updateItem fileURL]];
|
||||
[request setValue:[updater userAgentString] forHTTPHeaderField:@"User-Agent"];
|
||||
download = [[NSURLDownload alloc] initWithRequest:request delegate:self];
|
||||
if (updateItem) {
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[updateItem fileURL]];
|
||||
[request setValue:[updater userAgentString] forHTTPHeaderField:@"User-Agent"];
|
||||
download = [[NSURLDownload alloc] initWithRequest:request delegate:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)d decideDestinationWithSuggestedFilename:(NSString *)name
|
||||
|
||||
+15
-13
@@ -52,19 +52,21 @@ static void peer_event_handler(xpc_connection_t peer, xpc_object_t event)
|
||||
const char *path = xpc_dictionary_get_string(event, "path");
|
||||
xpc_object_t array = xpc_dictionary_get_value(event, "arguments");
|
||||
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
NSString *relaunchToolPath = path ? [manager stringWithFileSystemRepresentation:path length:strlen(path)] : nil;;
|
||||
NSMutableArray *arguments = [NSMutableArray array];
|
||||
|
||||
for (size_t i = 0; i < xpc_array_get_count(array); i++) {
|
||||
[arguments addObject:
|
||||
[NSString stringWithUTF8String:xpc_array_get_string(array, i)]];
|
||||
}
|
||||
|
||||
NSError *launchError = nil;
|
||||
NSRunningApplication *runningApplication = [[NSWorkspace sharedWorkspace] launchApplicationAtURL:[NSURL fileURLWithPath:relaunchToolPath] options:NSWorkspaceLaunchNewInstance configuration:@{NSWorkspaceLaunchConfigurationArguments:arguments} error:&launchError];
|
||||
[runningApplication activateWithOptions:NSApplicationActivateIgnoringOtherApps];
|
||||
|
||||
if (path) {
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
NSString *relaunchToolPath = [manager stringWithFileSystemRepresentation:path length:strlen(path)];
|
||||
NSMutableArray *arguments = [NSMutableArray array];
|
||||
|
||||
for (size_t i = 0; i < xpc_array_get_count(array); i++) {
|
||||
[arguments addObject:
|
||||
[NSString stringWithUTF8String:xpc_array_get_string(array, i)]];
|
||||
}
|
||||
|
||||
NSError *launchError = nil;
|
||||
NSRunningApplication *runningApplication = [[NSWorkspace sharedWorkspace] launchApplicationAtURL:[NSURL fileURLWithPath:relaunchToolPath] options:NSWorkspaceLaunchNewInstance configuration:@{NSWorkspaceLaunchConfigurationArguments:arguments} error:&launchError];
|
||||
[runningApplication activateWithOptions:NSApplicationActivateIgnoringOtherApps];
|
||||
}
|
||||
|
||||
// send response to indicate ok
|
||||
xpc_object_t reply = xpc_dictionary_create_reply(event);
|
||||
xpc_connection_send_message(peer, reply);
|
||||
|
||||
Reference in new issue
Block a user