From 479dac66a19debcc50d230e1e779112a75ea63b8 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 30 Mar 2023 16:17:28 +0200 Subject: [PATCH] MOBILE-4270 data: Catch errors when deleting --- src/addons/mod/data/services/data-helper.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/addons/mod/data/services/data-helper.ts b/src/addons/mod/data/services/data-helper.ts index 52b822c95..40751a9c5 100644 --- a/src/addons/mod/data/services/data-helper.ts +++ b/src/addons/mod/data/services/data-helper.ts @@ -714,7 +714,9 @@ export class AddonModDataHelperProvider { courseId = await this.getActivityCourseIdIfNotSet(dataId, courseId, siteId); } - AddonModData.deleteEntry(dataId, entryId, courseId!, siteId); + if (courseId) { + await AddonModData.deleteEntry(dataId, entryId, courseId, siteId); + } } catch (message) { CoreDomUtils.showErrorModalDefault(message, 'addon.mod_data.errordeleting', true);