Prevent possible crash, if label field is empty in database.

This commit is contained in:
Mattias Põldaru 2011-03-15 00:29:02 +02:00
parent 78c539e1d8
commit 1ce88e7a2a

View File

@ -269,6 +269,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if index is None: if index is None:
index = VerseType.Other index = VerseType.Other
verse[0][u'type'] = VerseType.Tags[index] verse[0][u'type'] = VerseType.Tags[index]
if verse[0][u'label'] == u'':
verse[0][u'label'] = u'1'
verse_def = u'%s%s' % (verse[0][u'type'], verse[0][u'label']) verse_def = u'%s%s' % (verse[0][u'type'], verse[0][u'label'])
item = QtGui.QTableWidgetItem(verse[1]) item = QtGui.QTableWidgetItem(verse[1])
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def)) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def))