EventsEdit: Handle no events existing

This commit is contained in:
Hornwitser 2025-03-05 19:10:24 +01:00
parent 5cc310384e
commit e45e51ef7a

View file

@ -84,7 +84,9 @@ const schedule = useSchedule();
const eventSelect = useTemplateRef("eventSelect");
function onChange(event: any) {
const newEvent = schedule.value.events.find(e => e.id === event.target.value)!;
const newEvent = schedule.value.events.find(e => e.id === event.target.value);
if (!newEvent)
return;
const form = event.target.form!;
for (const element of form.elements as any) {
if (element.name === "name") {