Skip to content

Commit

Permalink
Fixed for app crash if push configured
Browse files Browse the repository at this point in the history
(cherry picked from commit aff0794)
  • Loading branch information
Bhakta committed Jan 11, 2016
1 parent 030753a commit 4f89e04
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/commonAPI/coreapi/ext/shared/PushImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ namespace push {
//----------------------------------------------------------------------------------------------------------------------
CPushManager* CPushManager::getInstance()
{
return reinterpret_cast<CPushManager*>(CPushFactoryBase::getInstance()->getModuleSingleton());
CPushFactoryBase* pInstance = CPushFactoryBase::getInstance();
if (pInstance){
LOG(TRACE) + "Returning CPushManager Instance";
return reinterpret_cast<CPushManager*>(pInstance->getModuleSingleton());
}else{
LOG(TRACE) + "CPushFactoryBase::getInstance is empty. Returning 0";
return 0;
}
}

//----------------------------------------------------------------------------------------------------------------------
Expand Down
7 changes: 6 additions & 1 deletion platform/android/Rhodes/jni/src/rhodesapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,12 @@ RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_setPushRegistrat
std::string strType = jType ? rho_cast<std::string>(env, jType) : "";
std::string deviceId = rho_cast<std::string>(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
Expand Down

0 comments on commit 4f89e04

Please sign in to comment.