From a02faab3fe85e4d44e232b18e0a0b4cba17da449 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sun, 7 Jul 2019 20:07:16 -0400 Subject: [PATCH] don't embed emus that don't exist --- fun.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fun.go b/fun.go index 4b9465d..53dfbf8 100644 --- a/fun.go +++ b/fun.go @@ -193,6 +193,10 @@ func herdofemus(noise string) []Emu { var emus []Emu for _, e := range m { fname := e[1 : len(e)-1] + _, err := os.Stat("emus/" + fname + ".png") + if err != nil { + continue + } url := fmt.Sprintf("https://%s/emu/%s.png", serverName, fname) emus = append(emus, Emu{ID: url, Name: e}) }