From: Dawid Juszczak Date: Mon, 23 Sep 2019 09:58:34 +0000 (+0200) Subject: [mediacontroller][fix] fixed error with subscribe method X-Git-Tag: submit/tizen/20190930.141103~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4d800adf927df80e1f84c5e1c31d0ffb7c23de1;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [mediacontroller][fix] fixed error with subscribe method before that commit, if subscribed method was executed on already subscribed server then unknown error was thrown Now it is fixed. [verification] tested manually on chrome console Change-Id: I7d5fe3d0d09eb95d6542ebfb2e163ca32c5d01a0 Signed-off-by: Dawid Juszczak --- diff --git a/src/mediacontroller/mediacontroller_client.cc b/src/mediacontroller/mediacontroller_client.cc index 9f773509..0fee47b6 100644 --- a/src/mediacontroller/mediacontroller_client.cc +++ b/src/mediacontroller/mediacontroller_client.cc @@ -705,6 +705,12 @@ PlatformResult MediaControllerClient::SubscribeServer(const std::string& server_ "Unable to subscribe server, AbilityChangeListener is not set"); } + auto srv = std::find(subscribed_servers.begin(), subscribed_servers.end(), server_name); + if (srv != subscribed_servers.end()) { + LoggerD("server %s is already subscribed", server_name.c_str()); + return PlatformResult(ErrorCode::NO_ERROR); + } + SCOPE_EXIT { if (to_unsubscribe > 0) { for (auto type : types::MediaControllerSubscriptionTypeEnum) {