From 44a2ceab3c23ec6ba1fa4dfd182086cefd1e5cf6 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 17 Jan 2019 17:09:22 +0100 Subject: [PATCH] qt history list: fix minor sorting issue closes #4989 --- electrum/gui/qt/history_list.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py index e785ddd0..acf610e7 100644 --- a/electrum/gui/qt/history_list.py +++ b/electrum/gui/qt/history_list.py @@ -29,6 +29,7 @@ from datetime import date from typing import TYPE_CHECKING, Tuple, Dict import threading from enum import IntEnum +from decimal import Decimal from electrum.address_synchronizer import TX_HEIGHT_LOCAL from electrum.i18n import _ @@ -77,9 +78,14 @@ class HistorySortModel(QSortFilterProxyModel): item2 = self.sourceModel().data(source_right, Qt.UserRole) if item1 is None or item2 is None: raise Exception(f'UserRole not set for column {source_left.column()}') - if item1.value() is None or item2.value() is None: + v1 = item1.value() + v2 = item2.value() + if v1 is None or isinstance(v1, Decimal) and v1.is_nan(): v1 = -float("inf") + if v2 is None or isinstance(v2, Decimal) and v2.is_nan(): v2 = -float("inf") + try: + return v1 < v2 + except: return False - return item1.value() < item2.value() class HistoryModel(QAbstractItemModel, PrintError):