aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rates.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rates.ts b/lib/rates.ts
index f840592e..6172f5eb 100644
--- a/lib/rates.ts
+++ b/lib/rates.ts
@@ -16,9 +16,10 @@ let connect = async () => {
ws.onmessage = async function (event) {
try {
let msg = JSON.parse(event.data);
- let rates = await g("rates");
+ let rates = await g("rates") || {};
let fx = await g("fx");
if (fx) ({ fx } = fx);
+ if (!fx) return;
Object.keys(fx).map((symbol) => {
rates[symbol] = msg.c * fx[symbol];