summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuller, Alexander (A.) <amulle19@ford.com>2016-12-13 15:58:45 -0800
committerMuller, Alexander (A.) <amulle19@ford.com>2016-12-13 15:58:45 -0800
commitb3987057bee00cf9fe1701ac6a944d620b7574f5 (patch)
treec540c477d1031d572ae690ddbb462203fe88ec95
parent723235033368328ffc0855cd3781cb7f12b3b929 (diff)
downloadsdl_ios-b3987057bee00cf9fe1701ac6a944d620b7574f5.tar.gz
Fixed issue with trying to upload a file that is nil will cause an infinite loop.
-rw-r--r--SmartDeviceLink/SDLFileManager.m17
1 files changed, 11 insertions, 6 deletions
diff --git a/SmartDeviceLink/SDLFileManager.m b/SmartDeviceLink/SDLFileManager.m
index 84b20b890..21e476a2e 100644
--- a/SmartDeviceLink/SDLFileManager.m
+++ b/SmartDeviceLink/SDLFileManager.m
@@ -221,24 +221,29 @@ SDLFileManagerState *const SDLFileManagerStateStartupError = @"StartupError";
- (void)uploadFile:(SDLFile *)file completionHandler:(nullable SDLFileManagerUploadCompletionHandler)handler {
if (file == nil) {
- handler(NO, self.bytesAvailable, [NSError sdl_fileManager_unableToUploadError]);
+ if (handler != nil) {
+ handler(NO, self.bytesAvailable, [NSError sdl_fileManager_unableToUploadError]);
+ }
+ return;
}
-
+
// Make sure we are able to send files
if (![self.currentState isEqualToString:SDLFileManagerStateReady]) {
- handler(NO, self.bytesAvailable, [NSError sdl_fileManager_unableToUploadError]);
+ if (handler != nil) {
+ handler(NO, self.bytesAvailable, [NSError sdl_fileManager_unableToUploadError]);
+ }
return;
}
-
+
// Check our overwrite settings and error out if it would overwrite
if (file.overwrite == NO && [self.remoteFileNames containsObject:file.name]) {
if (handler != nil) {
handler(NO, self.bytesAvailable, [NSError sdl_fileManager_cannotOverwriteError]);
}
-
+
return;
}
-
+
// If we didn't error out over the overwrite, then continue on
[self sdl_uploadFile:file completionHandler:handler];
}