Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix automation view crash when no config found #504

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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