Do not error out if there is an invalid regex for title sort set in tweaks

This commit is contained in:
Kovid Goyal 2011-11-04 22:49:09 +05:30
parent 75341b3c99
commit 2532de27fb

View File

@ -116,10 +116,14 @@ def title_sort(title, order=None):
title = title[1:]
match = _title_pat.search(title)
if match:
prep = match.group(1)
title = title[len(prep):] + ', ' + prep
if title[0] in _ignore_starts:
title = title[1:]
try:
prep = match.group(1)
except IndexError:
pass
else:
title = title[len(prep):] + ', ' + prep
if title[0] in _ignore_starts:
title = title[1:]
return title.strip()
coding = zip(