From d160fc08f015f205d1e9da20fa7e07a4a3680a76 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 5 Jun 2012 14:21:31 +0200 Subject: [PATCH] Fix null pointer exception when call released --- Classes/LinphoneUI/LinphoneManager.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index 8976216df..1f2b3dded 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -141,6 +141,14 @@ extern void libmsbcg729_init(); } -(void) onCall:(LinphoneCall*) call StateChanged: (LinphoneCallState) new_state withMessage: (const char *) message { + if(new_state == LinphoneCallReleased) { + if(linphone_call_get_user_pointer(call) != NULL) { + free (linphone_call_get_user_pointer(call)); + linphone_call_set_user_pointer(call, NULL); + } + return; + } + const char* lUserNameChars=linphone_address_get_username(linphone_call_get_remote_address(call)); NSString* lUserName = lUserNameChars?[[[NSString alloc] initWithUTF8String:lUserNameChars] autorelease]:NSLocalizedString(@"Unknown",nil); if (new_state == LinphoneCallIncomingReceived) { @@ -269,9 +277,6 @@ extern void libmsbcg729_init(); [callDelegate displayInCall:call FromUI:mCurrentViewController forUser:lUserName withDisplayName:lDisplayName]; } break; - case LinphoneCallReleased: - free (linphone_call_get_user_pointer(call)); - break; default: break; }