Lib: Fix nullpointer in RacePickCard/SubstitutionCard preview handler
All checks were successful
Build Formula11 Docker Image / pocketbase-docker (push) Successful in 26s

This commit is contained in:
2025-02-05 03:01:29 +01:00
parent da47668c29
commit 8cb665cae8
2 changed files with 8 additions and 2 deletions

View File

@ -37,7 +37,10 @@
const src: string =
get_by_value<Driver>(await data.drivers, "code", target.value)?.headshot_url || "";
(document.getElementById("headshot_preview") as HTMLImageElement).src = src;
const img = document.getElementById("headshot_preview") as HTMLImageElement;
// Can be null if lazyimg not loaded
if (img) img.src = src;
};
const required: boolean = $derived(!racepick);

View File

@ -37,7 +37,10 @@
const src: string =
get_by_value<Driver>(await data.drivers, "code", target.value)?.headshot_url ?? "";
(document.getElementById("headshot_preview") as HTMLImageElement).src = src;
const img = document.getElementById("headshot_preview") as HTMLImageElement;
// Can be null if lazyimage hasn't loaded
if (img) img.src = src;
};
const active_drivers = (drivers: Driver[]): Driver[] =>