URIUtils: fix out of range exception in resolvePath()
authormontellese <montellese@xbmc.org>
Mon, 3 Mar 2014 22:43:01 +0000 (23:43 +0100)
committermontellese <montellese@xbmc.org>
Fri, 7 Mar 2014 20:44:59 +0000 (21:44 +0100)
xbmc/utils/URIUtils.cpp

index ea4ff97..12dadba 100644 (file)
@@ -1226,10 +1226,12 @@ std::string URIUtils::resolvePath(const std::string &path)
   CStdString realPath;
   int i = 0;
   // re-add any / or \ at the beginning
-  while (path.at(i) == delim.at(0))
+  for (std::string::const_iterator itPath = path.begin(); itPath != path.end(); ++itPath)
   {
+    if (*itPath != delim.at(0))
+      break;
+
     realPath += delim;
-    i++;
   }
   // put together the path
   realPath += StringUtils::Join(realParts, delim);