message: Fix issue when SDL shut down due to SIGSEGV
  - replaced iter to SharedPointer ins CommandRequestImpl to
  access application
diff: @@ -493,32 +493,33 @@ bool CommandRequestImpl::CheckAllowedParameters() {
  return true;
  }
  - const ApplicationSet& accessor =
  - application_manager_.applications().GetData();
  - ApplicationSetConstIt it_app_list = accessor.begin();
  - ApplicationSetConstIt it_app_list_end = accessor.end();
  - for (; it_app_list != it_app_list_end; ++it_app_list) {
  - if (connection_key() == (*it_app_list).get()->app_id()) {
  + const ApplicationConstSharedPtr app =
  + application_manager_.application(connection_key());
  + if (!app) {
  + LOG4CXX_ERROR(logger_,
  + "There is no registered application with "
  + "connection key '"
  + << connection_key() << "'");
  + return false;
  + }
  +
  RPCParams params;
  - const smart_objects::SmartObject& s_map =
  - (*message_)[strings::msg_params];
  - if (smart_objects::SmartType_Map == s_map.getType()) {
  - smart_objects::SmartMap::iterator iter = s_map.map_begin();
  - smart_objects::SmartMap::iterator iter_end = s_map.map_end();
  + const smart_objects::SmartObject& s_map = (*message_)[strings::msg_params];
  + smart_objects::SmartMap::const_iterator iter = s_map.map_begin();
  + smart_objects::SmartMap::const_iterator iter_end = s_map.map_end();
  for (; iter != iter_end; ++iter) {
  - if (true == iter->second.asBool()) {
  + if (iter->second.asBool()) {
  LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first);
  params.insert(iter->first);
  }
  }
  - }
  mobile_apis::Result::eType check_result =
  application_manager_.CheckPolicyPermissions(
  - (*it_app_list).get()->policy_app_id(),
  - (*it_app_list).get()->hmi_level(),
  + app->policy_app_id(),
  + app->hmi_level(),
  static_cast<mobile_api::FunctionID::eType>(function_id()),
  params,
  &parameters_permissions_);
  @@ -530,7 +531,7 @@ bool CommandRequestImpl::CheckAllowedParameters() {
  static_cast<mobile_api::FunctionID::eType>(function_id()),
  check_result,
  correlation_id(),
  - (*it_app_list)->app_id());
  + app->app_id());
  application_manager_.SendMessageToMobile(response);
  return false;
  @@ -545,8 +546,7 @@ bool CommandRequestImpl::CheckAllowedParameters() {
  }
  RemoveDisallowedParameters();
  - }
  - }
  +
  return true;
  }
  