From d41f69ce8cd11b79da163c3b19743cab381467bf Mon Sep 17 00:00:00 2001 From: Philip Ridout Date: Wed, 11 Jul 2012 21:41:31 +0100 Subject: [PATCH] Fixes 1011286 Song Editor -> Edit All Crashes with out valid verse splitter. Plus a small bit of refactoring --- openlp/plugins/songs/forms/editverseform.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/forms/editverseform.py b/openlp/plugins/songs/forms/editverseform.py index 1c00217b6..8493825b0 100644 --- a/openlp/plugins/songs/forms/editverseform.py +++ b/openlp/plugins/songs/forms/editverseform.py @@ -186,10 +186,23 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog): return text def accept(self): - if self.hasSingleVerse: - if not self.getVerse()[0]: + value = unicode(self.getVerse()[0]) + if not self.hasSingleVerse: + value = value.split(u'\n') + if len(value) <= 1: critical_error_message_box( message=translate('SongsPlugin.EditSongForm', - 'You need to type some text in to the verse.')) + 'Invalid entry, you need a verse splitter and some text.')) return False + if not value: + lines = unicode(self.getVerse()[0]).split(u'\n') + index = 2 + while index < len(lines) and not value: + value = lines[index] + index += 1 + if not value: + critical_error_message_box( + message=translate('SongsPlugin.EditSongForm', + 'You need to type some text in to the verse.')) + return False QtGui.QDialog.accept(self)