texchange_rate: fix #5487 - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 93d68a43611ec22369206f3edb03030b1d6fcb3e DIR parent 650225e238a1a9db07d713cf202f0ed1e51a92e7 HTML Author: SomberNight <somber.night@protonmail.com> Date: Thu, 4 Jul 2019 19:55:03 +0200 exchange_rate: fix #5487 Diffstat: M electrum/exchange_rate.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- DIR diff --git a/electrum/exchange_rate.py b/electrum/exchange_rate.py t@@ -563,7 +563,8 @@ class FxThread(ThreadJob): self.logger.info(f"using exchange {name}") if self.config_exchange() != name: self.config.set_key('use_exchange', name, True) - self.exchange = class_(self.on_quotes, self.on_history) + assert issubclass(class_, ExchangeBase), f"unexpected type {class_} for {name}" + self.exchange = class_(self.on_quotes, self.on_history) # type: ExchangeBase # A new exchange means new fx quotes, initially empty. Force # a quote refresh self.trigger_update() t@@ -616,6 +617,8 @@ class FxThread(ThreadJob): # Use spot quotes in that case if rate == 'NaN' and (datetime.today().date() - d_t.date()).days <= 2: rate = self.exchange.quotes.get(self.ccy, 'NaN') + if rate is None: + rate = 'NaN' self.history_used_spot = True return Decimal(rate)