aboutsummaryrefslogtreecommitdiffstats
path: root/src/hs-clientmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hs-clientmanager.cpp')
-rw-r--r--src/hs-clientmanager.cpp16
1 files changed, 12 insertions, 4 deletions
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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> lock(this->mtx);
auto ip = client_list.find(appid);
if(ip != client_list.end()
&& ip->second->unsubscribe(request, value) != 0) {