tfix #3783 - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 743ef9ec8f1e69c56f587359f00de19f4f05ff0a DIR parent 7ab9fa5be48cf5aefec98d94657241c73a6e280c HTML Author: SomberNight <somber.night@protonmail.com> Date: Sun, 28 Jan 2018 01:56:26 +0100 fix #3783 Diffstat: M lib/exchange_rate.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- DIR diff --git a/lib/exchange_rate.py b/lib/exchange_rate.py t@@ -5,6 +5,7 @@ import sys from threading import Thread import time import csv +import decimal from decimal import Decimal from .bitcoin import COIN t@@ -389,7 +390,11 @@ class FxThread(ThreadJob): def ccy_amount_str(self, amount, commas): prec = CCY_PRECISIONS.get(self.ccy, 2) fmt_str = "{:%s.%df}" % ("," if commas else "", max(0, prec)) - return fmt_str.format(round(amount, prec)) + try: + rounded_amount = round(amount, prec) + except decimal.InvalidOperation: + rounded_amount = amount + return fmt_str.format(rounded_amount) def run(self): # This runs from the plugins thread which catches exceptions