From 7c8cff7708cef68017875175eaae2d02e15a15af Mon Sep 17 00:00:00 2001 From: Nelson Chan Date: Thu, 23 Feb 2023 17:02:16 +0800 Subject: [PATCH] Fix: Add null check for injected HTML --- src/pages/StatusPage.vue | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/pages/StatusPage.vue b/src/pages/StatusPage.vue index f4a6eb76d..edf32561b 100644 --- a/src/pages/StatusPage.vue +++ b/src/pages/StatusPage.vue @@ -502,15 +502,27 @@ export default { }, incidentHTML() { - return DOMPurify.sanitize(marked(this.incident.content)); + if (this.incident.content != null) { + return DOMPurify.sanitize(marked(this.incident.content)); + } else { + return ""; + } }, descriptionHTML() { - return DOMPurify.sanitize(marked(this.config.description)); + if (this.config.description != null) { + return DOMPurify.sanitize(marked(this.config.description)); + } else { + return ""; + } }, footerHTML() { - return DOMPurify.sanitize(marked(this.config.footerText)); + if (this.config.footerText != null) { + return DOMPurify.sanitize(marked(this.config.footerText)); + } else { + return ""; + } }, }, watch: {