Protect against blank titles causing a stack traceback

This commit is contained in:
Sam Ruby 2010-08-15 10:45:34 -04:00
parent 206b21edc9
commit 4aa9087271

View File

@ -419,7 +419,7 @@ for i in range(0,len(weighted_links)):
title = re.sub('&#x(\w+);',lambda n: unichr(int(n.group(1),16)), title)
# title too long? Insert zero width spaces where appropriate
if max(map(len,title.split())) > 30:
if len(title.strip())>0 and max(map(len,title.split())) > 30:
title=re.sub('(\W+)',u'\\1\u200b',title)
# save the entry title (it is used later)