check emus really exist before embedding
Ted Unangst tedu@tedunangst.com
Sat, 30 Dec 2023 16:56:49 -0500
1 files changed,
6 insertions(+),
6 deletions(-)
jump to
M
fun.go
→
fun.go
@@ -162,8 +162,8 @@ }
} } if local && h.What != "bonked" { - emu, ok := emucache.Get(e) - if ok { + emu, _ := emucache.Get(e) + if emu.ID != "" { return fmt.Sprintf(`<img class="emu" title="%s" src="%s">`, emu.Name, emu.ID) } }@@ -264,8 +264,8 @@ }
} } if local { - emu, ok := emucache.Get(e) - if ok { + emu, _ := emucache.Get(e) + if emu.ID != "" { return fmt.Sprintf(`<img class="emu" title="%s" src="%s">`, emu.Name, emu.ID) } }@@ -444,8 +444,8 @@ m := re_emus.FindAllString(noise, -1)
m = oneofakind(m) var emus []Emu for _, e := range m { - emu, ok := emucache.Get(e) - if !ok { + emu, _ := emucache.Get(e) + if emu.ID == "" { continue } emus = append(emus, emu)