From 9f2d0a40aab46f7b9e126829cae2de055323ffca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Tue, 8 Jan 2019 10:33:09 +0100 Subject: [PATCH] MOBILE-2795 forum: Error when navigating to invalid discussion --- src/addon/mod/forum/pages/discussion/discussion.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/addon/mod/forum/pages/discussion/discussion.ts b/src/addon/mod/forum/pages/discussion/discussion.ts index e652dab7c..16d5537b2 100644 --- a/src/addon/mod/forum/pages/discussion/discussion.ts +++ b/src/addon/mod/forum/pages/discussion/discussion.ts @@ -253,6 +253,10 @@ export class AddonModForumDiscussionPage implements OnDestroy { const posts = offlineReplies.concat(onlinePosts); this.discussion = this.forumProvider.extractStartingPost(posts); + if (!this.discussion) { + return Promise.reject('Invalid forum discussion'); + } + // If sort type is nested, normal sorting is disabled and nested posts will be displayed. if (this.sort == 'nested') { // Sort first by creation date to make format tree work.