qml: try-except around data query, history is very unpredictable what's present and what's not
This commit is contained in:
@@ -35,7 +35,13 @@ class QETransactionListModel(QAbstractListModel):
|
|||||||
def data(self, index, role):
|
def data(self, index, role):
|
||||||
tx = self.tx_history[index.row()]
|
tx = self.tx_history[index.row()]
|
||||||
role_index = role - Qt.UserRole
|
role_index = role - Qt.UserRole
|
||||||
value = tx[self._ROLE_NAMES[role_index]]
|
|
||||||
|
try:
|
||||||
|
value = tx[self._ROLE_NAMES[role_index]]
|
||||||
|
except KeyError as e:
|
||||||
|
self._logger.error(f'non-existing key "{self._ROLE_NAMES[role_index]}" requested')
|
||||||
|
value = None
|
||||||
|
|
||||||
if isinstance(value, (bool, list, int, str, QEAmount)) or value is None:
|
if isinstance(value, (bool, list, int, str, QEAmount)) or value is None:
|
||||||
return value
|
return value
|
||||||
if isinstance(value, Satoshis):
|
if isinstance(value, Satoshis):
|
||||||
|
|||||||
Reference in New Issue
Block a user