diff --git a/package.json b/package.json index 533a3bf..e3049f1 100644 --- a/package.json +++ b/package.json @@ -44,4 +44,4 @@ "browserslist": [ "last 1 chrome versions" ] -} +} \ No newline at end of file diff --git a/ts/smarttime.classes.cronmanager.ts b/ts/smarttime.classes.cronmanager.ts index f7ed75a..4673f18 100644 --- a/ts/smarttime.classes.cronmanager.ts +++ b/ts/smarttime.classes.cronmanager.ts @@ -64,8 +64,12 @@ export class CronManager { * stops all cronjobs */ public stop() { - this.status = 'stopped'; - this.executionTimeout.cancel(); + if (this.status === 'started') { + this.status = 'stopped'; + this.executionTimeout.cancel(); + } else { + console.log(`You tried to stop a CronManager that was not actually started.`); + } for (const cron of this.cronjobs.getArray()) { cron.stop(); }