don't embed emus that don't exist

This commit is contained in:
Ted Unangst 2019-07-07 20:07:16 -04:00
parent 9ba857823b
commit a02faab3fe
1 changed files with 4 additions and 0 deletions

4
fun.go
View File

@ -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})
}