anonradio: null checks

This commit is contained in:
Cynthia Foxwell 2023-08-03 20:18:08 -06:00
parent 0936ce6937
commit e212bade7b

View file

@ -68,9 +68,14 @@ async function updateNowPlaying() {
} else if (playing.startsWith("Coming up")) {
title = playing;
} else {
const [_, current, peakDay, peakMonth, dj, metadata] = playing.match(
const metadataLine = playing.match(
/\[(\d+)\/(\d+)\/(\d+)\] \((.+?)\): (.+)/
);
const current = metadataLine?.[1] ?? "??";
const peakDay = metadataLine?.[2] ?? "??";
const peakMonth = metadataLine?.[3] ?? "??";
const dj = metadataLine?.[4] ?? "unknown";
const metadata = metadataLine?.[5] ?? "unknown";
if (
metadata == "https://archives.anonradio.net" ||