Browse Source

qml: try-except around data query, history is very unpredictable what's present and what's not

patch-4
Sander van Grieken 2 years ago
parent
commit
1c852328c0
  1. 8
      electrum/gui/qml/qetransactionlistmodel.py

8
electrum/gui/qml/qetransactionlistmodel.py

@ -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):

Loading…
Cancel
Save