URIUtils: fix out of range exception in resolvePath() #4321

Merged
merged 1 commit into from Mar 5, 2014

Projects

None yet

5 participants

Owner

This fixes an out of range exception from

path.at(i)

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.

Contributor
t-nelson commented Mar 3, 2014

Iterators would be a better idea, no?

Owner

Yes but I wanted to change the code as little as possible. But I can do an iterator approach if that's ok.

Member

Yes, I don't like path.size() being evaluated every iteration of the loop.

Member

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?

Owner

@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.

Owner

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.

Member

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?)

Member

IMO it's not worth it in that case - mayaswell leave it as a string.

Owner

OK I've dropped the commit again.

Owner

jenkins build this please

@jmarshallnz jmarshallnz merged commit b6b5cee into xbmc:master Mar 5, 2014

1 check failed

default Merged build #317 failed in 8 min 3 sec
Details
Owner

Should I do a PR against Gotham or will someone cherry-pick the commit?

@MartijnKaijser MartijnKaijser added this to the H* 14.0-alpha1 milestone Mar 7, 2014
@jmarshallnz jmarshallnz removed the Gotham label Mar 8, 2014
@Montellese Montellese removed this from the Helix 14.0-alpha1 milestone Apr 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment