From ef6d16a799dbe7203ecc732abc558f02b46a8d2a Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 29 May 2026 14:56:23 +0200 Subject: cockpit: assert we have the a valid userId to fetch the icon --- cockpit/js/config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cockpit/js/config.js b/cockpit/js/config.js index 545c579..2beb91b 100644 --- a/cockpit/js/config.js +++ b/cockpit/js/config.js @@ -27,9 +27,11 @@ function getCourseParticipantsUrl() { } async function getUserIconUrl(userId) { + console.assert(userId, "getUserIconUrl needs a userId"); const userRes = await fetch(`https://lernplattform.bycs.de/user/profile.php?id=${userId}`) const userDoc = new DOMParser().parseFromString(await userRes.text(), 'text/html') - return userDoc.querySelector(".userpicture").src; + const userpicture = userDoc.querySelector(".userpicture"); + return userpicture ? userpicture.src : ""; } export { -- cgit v1.2.3