From 0339d7f6c37095acde288e17ff1d4538b31c8ac9 Mon Sep 17 00:00:00 2001 From: Vuong <3168632+vuon9@users.noreply.github.com> Date: Mon, 22 Nov 2021 05:37:30 +0700 Subject: [PATCH 1/2] Fix panic due to using wrong value for key (#285) Signed-off-by: Vuong <3168632+vuon9@users.noreply.github.com> --- cointop/coin.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cointop/coin.go b/cointop/coin.go index 8d2526e..4676101 100644 --- a/cointop/coin.go +++ b/cointop/coin.go @@ -1,8 +1,6 @@ package cointop import ( - "errors" - log "github.com/sirupsen/logrus" ) @@ -106,12 +104,6 @@ func (ct *Cointop) UpdateCoin(coin *Coin) error { return err } - k, found := ct.State.allCoinsSlugMap.Load(coin.Name) - if !found { - log.Debugf("UpdateCoin() could not found coin %s in the slug map", coin.Name) - return errors.New("could not find coin index in allCoinsSlugMap") - } - coin = &Coin{ ID: v.ID, Name: v.Name, @@ -131,7 +123,7 @@ func (ct *Cointop) UpdateCoin(coin *Coin) error { Slug: v.Slug, } - ct.State.allCoinsSlugMap.Store(k, coin) + ct.State.allCoinsSlugMap.Store(coin.Name, coin) return nil } From 9bffc260357343f9f511dacde7a61b5fbae525cc Mon Sep 17 00:00:00 2001 From: Vuong <3168632+vuon9@users.noreply.github.com> Date: Mon, 22 Nov 2021 05:38:23 +0700 Subject: [PATCH 2/2] Fix conversion key triggered in any menu (#289) --- cointop/conversion.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cointop/conversion.go b/cointop/conversion.go index c45ef94..5bb90fb 100644 --- a/cointop/conversion.go +++ b/cointop/conversion.go @@ -235,6 +235,10 @@ func (ct *Cointop) SetCurrencyConverstion(convert string) error { func (ct *Cointop) SetCurrencyConverstionFn(convert string) func() error { log.Debug("SetCurrencyConverstionFn()") return func() error { + if !ct.State.convertMenuVisible { + return nil + } + ct.HideConvertMenu() if err := ct.SetCurrencyConverstion(convert); err != nil {