From bd07f10cfb1c88734581a9c100e51886264c2e8d Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 26 Mar 2021 10:52:22 +0100 Subject: [PATCH] MOBILE-3653 course: Fix error in console on app start --- src/core/features/course/services/handlers/log-cron.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/features/course/services/handlers/log-cron.ts b/src/core/features/course/services/handlers/log-cron.ts index 1922f4e04..cb447acd8 100644 --- a/src/core/features/course/services/handlers/log-cron.ts +++ b/src/core/features/course/services/handlers/log-cron.ts @@ -37,6 +37,11 @@ export class CoreCourseLogCronHandlerService implements CoreCronHandler { */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async execute(siteId?: string, force?: boolean): Promise { + if (!siteId && !CoreSites.isLoggedIn()) { + // No current site, stop. + return; + } + const site = await CoreSites.getSite(siteId); return CoreCourse.logView(site.getSiteHomeId(), undefined, site.getId(), site.getInfo()?.sitename);