This fixes an out of range exception from
in the case where the content of path only consists of the delimiter character (e.g. the linux root path "/"). This has been reported in the forum: http://forum.xbmc.org/showthread.php?tid=188031.
Obviously Gotham material if accepted.
Iterators would be a better idea, no?
Yes but I wanted to change the code as little as possible. But I can do an iterator approach if that's ok.
Yes, I don't like path.size() being evaluated every iteration of the loop.
Agreed, iterators seem the better way to go here. In addition, delim appears to be a char masquerading as a string for no particular reason?
URIUtils: fix out of range exception in resolvePath()
@jmarshallnz delim is sometimes used as a char with delim.at(0) and sometimes as a string because std::string doesn't have a constructor that only takes a char.
I've updated the first commit to use an iterator. I've also added a second commit to cleanup the double-usage of delim as a std::string and a char. I'm happy to drop that commit if deemed unnecessary.
Ah, we don't have a version of Split() that takes a char. Everything else will be fine with the char though (including the appending?)
IMO it's not worth it in that case - mayaswell leave it as a string.
OK I've dropped the commit again.
jenkins build this please
Should I do a PR against Gotham or will someone cherry-pick the commit?