Browse Source

qml: QEAmount returns 0 when amount is undefined

an undefined amount triggers a hard to debug crash when None/undefined is passing the
python/QObject boundary, so let's default to 0
patch-4
Sander van Grieken 2 years ago
parent
commit
74e9c848cc
  1. 6
      electrum/gui/qml/qetypes.py

6
electrum/gui/qml/qetypes.py

@ -31,10 +31,16 @@ class QEAmount(QObject):
@pyqtProperty('qint64', notify=valueChanged)
def satsInt(self):
if self._amount_sat is None: # should normally be defined when accessing this property
self._logger.warning('amount_sat is undefined, returning 0')
return 0
return self._amount_sat
@pyqtProperty('qint64', notify=valueChanged)
def msatsInt(self):
if self._amount_msat is None: # should normally be defined when accessing this property
self._logger.warning('amount_msat is undefined, returning 0')
return 0
return self._amount_msat
@pyqtProperty(str, notify=valueChanged)

Loading…
Cancel
Save