Even will all of our checks, at some point we call the toggleLegend

when we don't have a legend to toggle. This fix should make we get no
type errors