diff --git a/lib/commonAPI/coreapi/ext/shared/PushImpl.cpp b/lib/commonAPI/coreapi/ext/shared/PushImpl.cpp index 3f68e88513f..f1e5db0ef21 100644 --- a/lib/commonAPI/coreapi/ext/shared/PushImpl.cpp +++ b/lib/commonAPI/coreapi/ext/shared/PushImpl.cpp @@ -37,7 +37,14 @@ namespace push { //---------------------------------------------------------------------------------------------------------------------- CPushManager* CPushManager::getInstance() { - return reinterpret_cast(CPushFactoryBase::getInstance()->getModuleSingleton()); + CPushFactoryBase* pInstance = CPushFactoryBase::getInstance(); + if (pInstance){ + LOG(TRACE) + "Returning CPushManager Instance"; + return reinterpret_cast(pInstance->getModuleSingleton()); + }else{ + LOG(TRACE) + "CPushFactoryBase::getInstance is empty. Returning 0"; + return 0; + } } //---------------------------------------------------------------------------------------------------------------------- diff --git a/platform/android/Rhodes/jni/src/rhodesapp.cpp b/platform/android/Rhodes/jni/src/rhodesapp.cpp index 9cfdbaccaf6..963b38af8a9 100644 --- a/platform/android/Rhodes/jni/src/rhodesapp.cpp +++ b/platform/android/Rhodes/jni/src/rhodesapp.cpp @@ -332,7 +332,12 @@ RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_setPushRegistrat std::string strType = jType ? rho_cast(env, jType) : ""; std::string deviceId = rho_cast(env, jId); - rho::push::CPushManager::getInstance()->setDeviceId(strType, deviceId); + rho::push::CPushManager* pInstance = rho::push::CPushManager::getInstance(); + if (pInstance){ + pInstance->setDeviceId(strType, deviceId); + }else{ + RAWTRACE("rho::push::CPushManager::getInstance is empty"); + } } RHO_GLOBAL jboolean JNICALL Java_com_rhomobile_rhodes_RhodesService_callPushCallback