summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Muller <Dukelax713@gmail.com>2016-12-13 20:09:19 -0800
committerGitHub <noreply@github.com>2016-12-13 20:09:19 -0800
commita3b8baf5eff7c90594e5ad60cd6ce967a7119c9e (patch)
treee4aa1f49e84cc840538c17eea05d8ad5975b6333
parentb3987057bee00cf9fe1701ac6a944d620b7574f5 (diff)
parente8f40c6dcd3b3cdfd80da33b75fc571b30ee5d7b (diff)
downloadsdl_ios-a3b8baf5eff7c90594e5ad60cd6ce967a7119c9e.tar.gz
Merge pull request #482 from smartdevicelink/hotfix/issue_481
Added nil-checks for blocks in SDLStreamingMediaManager
-rw-r--r--SmartDeviceLink/SDLStreamingMediaManager.m19
1 files changed, 18 insertions, 1 deletions
diff --git a/SmartDeviceLink/SDLStreamingMediaManager.m b/SmartDeviceLink/SDLStreamingMediaManager.m
index ee64109c3..63321f134 100644
--- a/SmartDeviceLink/SDLStreamingMediaManager.m
+++ b/SmartDeviceLink/SDLStreamingMediaManager.m
@@ -145,6 +145,8 @@ NS_ASSUME_NONNULL_BEGIN
typeof(weakSelf) strongSelf = weakSelf;
// If success, we will get an ACK or NACK, so those methods will handle calling the video block
if (!success) {
+ if (strongSelf.videoStartBlock == nil) { return; }
+
strongSelf.videoStartBlock(NO, NO, error);
strongSelf.videoStartBlock = nil;
}
@@ -180,6 +182,8 @@ NS_ASSUME_NONNULL_BEGIN
typeof(weakSelf) strongSelf = weakSelf;
// If this passes, we will get an ACK or NACK, so those methods will handle calling the audio block
if (!success) {
+ if (strongSelf.audioStartBlock == nil) { return; }
+
strongSelf.audioStartBlock(NO, NO, error);
strongSelf.audioStartBlock = nil;
}
@@ -277,6 +281,9 @@ NS_ASSUME_NONNULL_BEGIN
case SDLServiceType_Audio: {
self.audioSessionConnected = YES;
self.audioSessionEncrypted = header.encrypted;
+
+ if (self.audioStartBlock == nil) { return; }
+
self.audioStartBlock(YES, header.encrypted, nil);
self.audioStartBlock = nil;
} break;
@@ -287,14 +294,20 @@ NS_ASSUME_NONNULL_BEGIN
if (!success) {
[self sdl_teardownCompressionSession];
[self.protocol endServiceWithType:SDLServiceType_Video];
+
+ if (self.videoStartBlock == nil) { return; }
+
self.videoStartBlock(NO, header.encrypted, error);
self.videoStartBlock = nil;
-
+
return;
}
self.videoSessionConnected = YES;
self.videoSessionEncrypted = header.encrypted;
+
+ if (self.videoStartBlock == nil) { return; }
+
self.videoStartBlock(YES, header.encrypted, nil);
self.videoStartBlock = nil;
} break;
@@ -307,12 +320,16 @@ NS_ASSUME_NONNULL_BEGIN
case SDLServiceType_Audio: {
NSError *error = [NSError errorWithDomain:SDLErrorDomainStreamingMediaAudio code:SDLStreamingAudioErrorHeadUnitNACK userInfo:nil];
+ if (self.audioStartBlock == nil) { return; }
+
self.audioStartBlock(NO, NO, error);
self.audioStartBlock = nil;
} break;
case SDLServiceType_Video: {
NSError *error = [NSError errorWithDomain:SDLErrorDomainStreamingMediaVideo code:SDLStreamingVideoErrorHeadUnitNACK userInfo:nil];
+ if (self.videoStartBlock == nil) { return; }
+
self.videoStartBlock(NO, NO, error);
self.videoStartBlock = nil;
} break;