mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 04:43:35 +00:00
refactor: add guards around trivial index checks
This commit is contained in:
committed by
Carlos Valente
parent
242cefd35c
commit
426d42ab63
@@ -276,7 +276,12 @@ export function loadNow(
|
||||
return;
|
||||
}
|
||||
|
||||
const event = rundown.entries[metadata.timedEventOrder[eventIndex]] as PlayableEvent;
|
||||
const eventId = metadata.timedEventOrder[eventIndex];
|
||||
if (!eventId) {
|
||||
runtimeState.eventNow = null;
|
||||
return;
|
||||
}
|
||||
const event = rundown.entries[eventId] as PlayableEvent;
|
||||
runtimeState.rundown.selectedEventIndex = eventIndex;
|
||||
runtimeState.eventNow = event;
|
||||
}
|
||||
@@ -302,6 +307,10 @@ export function loadNext(
|
||||
return;
|
||||
}
|
||||
const nextId = metadata.playableEventOrder[nowPlayableIndex + 1];
|
||||
if (!nextId) {
|
||||
runtimeState.eventNext = null;
|
||||
return;
|
||||
}
|
||||
runtimeState.eventNext = rundown.entries[nextId] as PlayableEvent;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user