fixed bug #1299837 - crash when importing EW DB with unexpected data formatting

Fixes: https://launchpad.net/bugs/1299837
This commit is contained in:
Tomas Groth 2014-05-15 21:19:53 +02:00
parent 9e5a80fbd2
commit 764768f8ac
1 changed files with 8 additions and 1 deletions

View File

@ -188,7 +188,14 @@ class EasyWorshipSongImport(SongImport):
self.addAuthor(author_name.strip())
if words:
# Format the lyrics
result = strip_rtf(words, self.encoding)
result = None
try:
result = strip_rtf(words, self.encoding)
except UnicodeDecodeError:
# The unicode chars in the rtf was not escaped in the expected manor
self.logError(self.title, unicode(translate('SongsPlugin.EasyWorshipSongImport',
'Unexpected data formatting.')))
continue
if result is None:
return
words, self.encoding = result