From 424f5e324fd26bcb1faf1457fa85ce1678745c71 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 19 Jul 2018 12:14:20 +0200 Subject: [PATCH] MOBILE-2512 workshop: Avoid error when downloading profiles in workshop --- src/addon/mod/workshop/providers/prefetch-handler.ts | 4 +++- src/core/user/providers/user.ts | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/addon/mod/workshop/providers/prefetch-handler.ts b/src/addon/mod/workshop/providers/prefetch-handler.ts index 6c5762737..5168d2a5e 100644 --- a/src/addon/mod/workshop/providers/prefetch-handler.ts +++ b/src/addon/mod/workshop/providers/prefetch-handler.ts @@ -363,7 +363,9 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH }); }).then(() => { // Prefetch user profiles. - return this.userProvider.prefetchProfiles(userIds, courseId, siteId); + return this.userProvider.prefetchProfiles(userIds, courseId, siteId).catch(() => { + // Ignore errors. + }); }); } } diff --git a/src/core/user/providers/user.ts b/src/core/user/providers/user.ts index 6cb79a6f4..45795a971 100644 --- a/src/core/user/providers/user.ts +++ b/src/core/user/providers/user.ts @@ -383,6 +383,10 @@ export class CoreUserProvider { promises = []; userIds.forEach((userId) => { + if (userId === null) { + return; + } + userId = Number(userId); // Make sure it's a number. // Prevent repeats and errors.