From bda388cd98d03baeb4ce7a6522a3aaf552e132b4 Mon Sep 17 00:00:00 2001 From: Jaehwan Lee Date: Mon, 13 May 2013 22:45:33 +0900 Subject: [PATCH] Fixed crash occurred when a listner does not exist Change-Id: If1e121987866bf9596dd99ea4e6f19965e1d2ee3 Signed-off-by: Jaehwan Lee --- src/FTel_SimStateManagerImpl.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/FTel_SimStateManagerImpl.cpp b/src/FTel_SimStateManagerImpl.cpp index 734c126..78b9beb 100644 --- a/src/FTel_SimStateManagerImpl.cpp +++ b/src/FTel_SimStateManagerImpl.cpp @@ -213,10 +213,14 @@ _SimStateManagerImpl::OnSimStateChangedCallback(TapiHandle* pHandle, const char* { pSimStateManagerImpl->__simState = state; - _SimEventArg* pEventArg = new (std::nothrow)_SimEventArg(_SIM_EVENT_SIM_STATE_CHANGED, state); - SysTryReturnVoidResult(NID_TEL, pEventArg != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + if (pSimStateManagerImpl->__pSimEvent != null) + { - (void)pSimStateManagerImpl->__pSimEvent->Fire(*pEventArg); + _SimEventArg* pEventArg = new (std::nothrow)_SimEventArg(_SIM_EVENT_SIM_STATE_CHANGED, state); + SysTryReturnVoidResult(NID_TEL, pEventArg != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + + (void)pSimStateManagerImpl->__pSimEvent->Fire(*pEventArg); + } } } @@ -259,10 +263,14 @@ _SimStateManagerImpl::OnGetPinLockSettingCallback(TapiHandle* pHandle, int ret, _SimStateManagerImpl* pSimStateManagerImpl = static_cast<_SimStateManagerImpl*>(pUserData); pSimStateManagerImpl->__isInProgress = false; - _SimManagerEventArg* pEventArg = new (std::nothrow)_SimManagerEventArg(_SIM_MANAGER_EVENT_PIN_LOCK_SETTING_RESULT_RECEIVED, isEnabled, r); - SysTryReturnVoidResult(NID_TEL, pEventArg != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - (void)pSimStateManagerImpl->__pSimManagerEvent->Fire(*pEventArg); + if (pSimStateManagerImpl->__pSimManagerEvent != null) + { + _SimManagerEventArg* pEventArg = new (std::nothrow)_SimManagerEventArg(_SIM_MANAGER_EVENT_PIN_LOCK_SETTING_RESULT_RECEIVED, isEnabled, r); + SysTryReturnVoidResult(NID_TEL, pEventArg != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + + (void)pSimStateManagerImpl->__pSimManagerEvent->Fire(*pEventArg); + } } result -- 2.7.4