diff --git a/src/viewProviders/RokuAutomationViewViewProvider.ts b/src/viewProviders/RokuAutomationViewViewProvider.ts index 9d99006f..e9539fdd 100644 --- a/src/viewProviders/RokuAutomationViewViewProvider.ts +++ b/src/viewProviders/RokuAutomationViewViewProvider.ts @@ -113,23 +113,25 @@ export class RokuAutomationViewViewProvider extends BaseRdbViewProvider { return Promise.resolve(true); }); - const config = this.rokuAutomationConfigs[index]; - for (const [index, step] of config.steps.entries()) { - if (stopRunning) { - break; - } - - this.updateCurrentRunningStep(index); - switch (step.type) { - case 'sleep': - await utils.sleep(+step.value * 1000); - break; - case 'sendText': - await ecp.sendText(step.value); - break; - case 'sendKeyPress': - await ecp.sendKeyPress(step.value as any); + const config = this.rokuAutomationConfigs?.[index]; + if (config) { + for (const [index, step] of config.steps.entries()) { + if (stopRunning) { break; + } + + this.updateCurrentRunningStep(index); + switch (step.type) { + case 'sleep': + await utils.sleep(+step.value * 1000); + break; + case 'sendText': + await ecp.sendText(step.value); + break; + case 'sendKeyPress': + await ecp.sendKeyPress(step.value as any); + break; + } } }