1
0

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
This commit is contained in:
Sander van Grieken
2022-08-12 14:56:00 +02:00
parent 13570a465c
commit 74e9c848cc

View File

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