[Convergence] Fixing SVACE issue 28/122428/2
authorPiotr Kosko <p.kosko@samsung.com>
Fri, 31 Mar 2017 09:08:20 +0000 (11:08 +0200)
committerPiotr Kosko <p.kosko@samsung.com>
Fri, 31 Mar 2017 09:29:15 +0000 (11:29 +0200)
[Verification] Code compiles without errors.

Change-Id: If7ee6db3ab6939160bfec11f0afe365b606393cc
Signed-off-by: Piotr Kosko <p.kosko@samsung.com>
src/convergence/convergence_service.cc

index 4f9167e0d11e558df55c6d63a06975876ff95d32..29992d7bba655de07980f5e163400f65c2ef396e 100644 (file)
@@ -190,19 +190,17 @@ picojson::value ConvergenceService::ToJson() const {
 
 std::vector<ConvergenceChannel*>::iterator ConvergenceService::GetChannel(const picojson::value &channel_json) {
   ScopeLogger();
-
-  std::vector<ConvergenceChannel*>::iterator it;
   const auto id = channel_json.get(kId).get<std::string>();
   const auto uri = channel_json.get(kUri).get<std::string>();
 
-  for (it = opened_channels.begin(); it != opened_channels.end(); ++it) {
+  for (auto it = opened_channels.begin(); it != opened_channels.end(); ++it) {
     if((*it)->GetUri() == uri && (*it)->GetId() == id) {
       LoggerD("Found channel uri: [%s] id: [%s]", uri.c_str(), id.c_str());
-      break;
+      return it;
     }
   }
 
-  return it;
+  return opened_channels.end();
 }
 
 bool ConvergenceService::IsChannelStarted(std::vector<ConvergenceChannel*>::iterator it) {