refactor: add guards around trivial index checks

This commit is contained in:
Carlos Valente
2025-12-11 17:59:46 +01:00
committed by Carlos Valente
parent 242cefd35c
commit 426d42ab63
7 changed files with 35 additions and 8 deletions
@@ -150,7 +150,9 @@ async function setAutomation(newData: AutomationSettings): ReadonlyPromise<Autom
function getRundown(rundownKey: string): Readonly<Rundown> {
if (!(rundownKey in db.data.rundowns)) throw new Error(`Rundown with id: ${rundownKey} not found`);
return db.data.rundowns[rundownKey];
const rundown = db.data.rundowns[rundownKey];
if (!rundown) throw new Error(`Rundown with id: ${rundownKey} not found`);
return rundown;
}
async function deleteRundown(rundownKey: string): Promise<ProjectRundowns> {