Skip to content

Commit

Permalink
Merge branch 'fix/CHT-548-crash-at-videoDeviceSelected' into 'release…
Browse files Browse the repository at this point in the history
…/v2.5.0'

CHT-548: Fix crash when creating NSString when getVideoDeviceSelected returns NULL (Obj-C)

See merge request megachat/MEGAchat!1216
  • Loading branch information
jnavarrom committed Aug 30, 2021
2 parents db21389 + 2f74f4b commit fc2dd94
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bindings/Objective-C/MEGAChatSdk.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,10 @@ - (void)setChatVideoInDevices:(NSString *)devices {
}

- (NSString *)videoDeviceSelected {
return self.megaChatApi ? [[NSString alloc] initWithUTF8String:self.megaChatApi->getVideoDeviceSelected()] : nil;
if (self.megaChatApi == nil) return nil;
char *selectedVideoDevice = self.megaChatApi->getVideoDeviceSelected();
if (!selectedVideoDevice) return nil;
return [[NSString alloc] initWithUTF8String:selectedVideoDevice];
}

- (void)startChatCall:(uint64_t)chatId enableVideo:(BOOL)enableVideo delegate:(id<MEGAChatRequestDelegate>)delegate {
Expand Down

0 comments on commit fc2dd94

Please sign in to comment.