From ac2edd6d745fd172e9a03588e0debeea26f64033 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Wed, 2 Sep 2020 14:09:21 +0000 Subject: [PATCH] fix(core): update --- package.json | 2 +- ts/smarttime.classes.cronmanager.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) 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(); }