diff options
Diffstat (limited to 'docs/superpowers/plans/2026-09-17-weather-widget.md')
| -rw-r--r-- | docs/superpowers/plans/2026-09-17-weather-widget.md | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/superpowers/plans/2026-09-17-weather-widget.md b/docs/superpowers/plans/2026-09-17-weather-widget.md index 853e08c..a7c9ef3 100644 --- a/docs/superpowers/plans/2026-09-17-weather-widget.md +++ b/docs/superpowers/plans/2026-09-17-weather-widget.md @@ -174,8 +174,12 @@ M.ICON = { -- face for the conditions that have both. function M.icon(id, now, sunrise, sunset) if type(id) ~= 'number' then return M.ICON.unknown end + -- `now` is guarded alongside sunrise and sunset, not just them: comparing a + -- nil now against a number raises, and a raise here is a blank dashboard. + -- Missing any of the three means the sun is unknown, so the day face is + -- drawn, which is what is_day() falls back to as well. local day = true - if sunrise and sunset then day = (now >= sunrise and now <= sunset) end + if now and sunrise and sunset then day = (now >= sunrise and now <= sunset) end local function pick(d, n) return day and d or n end if id <= 232 then return pick(M.ICON.thunder_day, M.ICON.thunder_night) |
