From 65ec8c1db2fbf78cb0c9b4b51c2cf98e8d515285 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sat, 7 Oct 2023 05:35:16 +0400 Subject: [PATCH] In index.pug avoid nil pointer dereferencing. --- web/templates/index.pug | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/templates/index.pug b/web/templates/index.pug index e5fb7b6..3743c90 100644 --- a/web/templates/index.pug +++ b/web/templates/index.pug @@ -45,8 +45,8 @@ html(lang='en') source(src='/live/stream.ogg' type='audio/ogg') | Your browser doesn't support an audio element, it's sad... But you always can take the #[a(href='/playlist') playlist]! div - - cur := *songList.Current() - if (cur.Artist != "") + if (songList.Current() != nil) + - cur := *songList.Current() p Now playing: #[span#radio-song #{cur.ArtistTitle()}] ( #[span#radio-duration-estimate ] #[span#radio-duration #{cur.DurationString()}] ) else p Now playing: #[span#radio-song ] ( #[span#radio-duration-estimate ] #[span#radio-duration ] )