X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fhs-clientmanager.cpp;fp=src%2Fhs-clientmanager.cpp;h=1355c99517c25169311f0e9987a97ce052739423;hb=b730d31a7e5e23756ab1b076de21d41369a500c5;hp=ba293262681285ed8ad5dd185772166ed189653c;hpb=31ff5ce755d00cf12ea2ffc96c33ed9acd36358f;p=apps%2Fagl-service-homescreen.git diff --git a/src/hs-clientmanager.cpp b/src/hs-clientmanager.cpp index ba29326..1355c99 100644 --- a/src/hs-clientmanager.cpp +++ b/src/hs-clientmanager.cpp @@ -254,9 +254,13 @@ int HS_ClientManager::subscribe(afb_req_t request) const char *value = afb_req_value(request, "event"); HMI_NOTICE("homescreen-service","value is %s", value); if(value) { - std::string appid(afb_req_get_application_id(request)); - std::lock_guard lock(this->mtx); + std::string appid =std::move(get_application_id(request)); + if(appid.empty()) { + HMI_NOTICE("homescreen-service","can't get application identifier"); + return AFB_REQ_GETAPPLICATIONID_ERROR; + } + std::lock_guard lock(this->mtx); HS_Client* client = nullptr; auto ip = client_list.find(appid); if(ip != client_list.end()) { @@ -295,9 +299,13 @@ int HS_ClientManager::unsubscribe(afb_req_t request) HMI_NOTICE("homescreen-service","value is %s", value); int ret = 0; if(value) { - std::string appid(afb_req_get_application_id(request)); - std::lock_guard lock(this->mtx); + std::string appid = std::move(get_application_id(request)); + if(appid.empty()) { + HMI_NOTICE("homescreen-service","can't get application identifier"); + return AFB_REQ_GETAPPLICATIONID_ERROR; + } + std::lock_guard lock(this->mtx); auto ip = client_list.find(appid); if(ip != client_list.end() && ip->second->unsubscribe(request, value) != 0) {