xbmc/xbmc — pull request #3654 by jmarshallnz (2013-11-14 22:33:22+00:00)
Title: Validation substr() usage prior to plowing ahead.

In the .Mid() removal, replacement with .substr() was done in some circumstances without checking the first parameter (pos) of substr(). If pos is greater than the string length, substr() will throw.

This fixes those locations associated with .Mid() -> substr() conversion.

I've specifically noted areas of the code that could do with a cleanup. Am confident about all commits, but would appreciate another eye.

Still todo is the .Left/.Right conversions, which potentially suffer the same fault (Right especially - Left should safe, as pos = 0 is never greater than string length).

@Montellese: An eye over the musicvideoalbum change in CVideoDatabase would be appreciated.