rdegges / cryptocompare

A static website that compares cryptocurrency prices for popular currencies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coin with no ImageUrl results in undefined error

haghdk opened this issue · comments

When calling getCoinImage: function(symbol) {} it will return an undefined error when it try to find an image for a coin with no ImageUrl in the cryptocompare API, which breaks the app.

I fixed it with

 try {

          return CRYPTOCOMPARE_URI + this.coinData[symbol].ImageUrl

        } catch(err) {
            console.log(err)
        }

Hey, can you explain how the fix code fit?

EDIT: Figured it out :)