From 87434f296e39ea8dd2064ed36fe34fe921a78255 Mon Sep 17 00:00:00 2001 From: Colin Cornaby Date: Sat, 17 Feb 2024 21:50:00 -0800 Subject: [PATCH] Adding guard against temp directory create failure createDirectoryAtURL technically is not supposed to take a nil value - guard against this. --- Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm b/Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm index 5cca6633d5..954b92a104 100644 --- a/Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm +++ b/Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm @@ -252,8 +252,10 @@ static la_ssize_t copy_data(struct archive *ar, struct archive *aw) NSError *error; NSURL *tempDirectory = [NSFileManager.defaultManager URLForDirectory:NSItemReplacementDirectory inDomain:NSUserDomainMask appropriateForURL:[NSURL fileURLWithPath:NSFileManager.defaultManager.currentDirectoryPath] create:YES error:&error]; - NSURL *outputURL = [tempDirectory URLByAppendingPathComponent:[NSString stringWithSTString:plManifest::PatcherExecutable().GetFileName()]]; - [NSFileManager.defaultManager createDirectoryAtURL:outputURL withIntermediateDirectories:false attributes:nil error:&error]; + if (tempDirectory) { + NSURL *outputURL = [tempDirectory URLByAppendingPathComponent:[NSString stringWithSTString:plManifest::PatcherExecutable().GetFileName()]]; + [NSFileManager.defaultManager createDirectoryAtURL:outputURL withIntermediateDirectories:false attributes:nil error:&error]; + } if (error) { // Not sure why things would go wrong, we should be able to