diff options
author | Andrey Oleynik <AOleynik@luxoft.com> | 2014-04-07 16:34:33 +0300 |
---|---|---|
committer | Justin Dickow <jjdickow@gmail.com> | 2014-07-09 14:02:09 -0400 |
commit | b167ad9fbe04f2c06db8ade90340239f1e0e945e (patch) | |
tree | 75700051f095a93740edc7ba7486de3ec8f2cc7f | |
parent | e049e1bef3b26dd3d4685a8c190977eb5932178c (diff) | |
download | smartdevicelink-b167ad9fbe04f2c06db8ade90340239f1e0e945e.tar.gz |
Hotfix: check for null pointer was added to SendMessageToSDK.
-rw-r--r-- | src/components/application_manager/src/policies/policy_handler.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index 985fc1346..d4bdd6ba4 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -363,9 +363,23 @@ bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string) { std::string url; uint32_t app_id = last_used_app_ids_.back(); if (policy_manager_) { - const std::string& mobile_app_id = - application_manager::ApplicationManagerImpl::instance()->application( - app_id)->mobile_app_id()->asString(); + application_manager::ApplicationSharedPtr app = + application_manager::ApplicationManagerImpl::instance() + ->application(app_id); + + if (!app.valid()) { + LOG4CXX_WARN(logger_, "There is no registered application with " + "connection key '"<<app_id<<"'"); + return false; + } + + const std::string& mobile_app_id = app->mobile_app_id()->asString(); + if (!mobile_app_id.empty()) { + LOG4CXX_WARN(logger_, "Application with connection key '" <<app_id<<"'" + " has no application id."); + return false; + } + url = policy_manager_->GetUpdateUrl(mobile_app_id); } LOG4CXX_INFO( |