Skip to content

Commit

Permalink
Fix automation view crash when no config found (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron committed Sep 29, 2023
1 parent 12dfb27 commit c49a541
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/viewProviders/RokuAutomationViewViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit c49a541

Please sign in to comment.