From 563e42c64043c7d0e74b25368b62c342c4d1efd6 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Tue, 4 Jan 2022 17:49:41 +0100 Subject: [PATCH] Fix errors. --- CHANGELOG.md | 6 +++++- conversejs/builtin.ts | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fc686d6..fa62563e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,14 @@ ## ??? -## Features +### Features * Builtin Prosody, Share chat url: ability to show/hide the scrollbar in readonly mode. +### Fixes + +* ConverseJS plugin livechatWindowTitlePlugin: Avoid errors when model is not initialized. + ## 5.2.4 ### Fixes diff --git a/conversejs/builtin.ts b/conversejs/builtin.ts index a22c684d..3d9c59ab 100644 --- a/conversejs/builtin.ts +++ b/conversejs/builtin.ts @@ -220,9 +220,11 @@ window.initConverse = async function initConverse ({ requestUpdate: function (this: any): any { console.log('[livechatWindowTitlePlugin] updating the document title.') try { - const title = this.model.getDisplayName() - if (document.title !== title) { - document.title = title + if (this.model?.getDisplayName) { + const title = this.model.getDisplayName() + if (document.title !== title) { + document.title = title + } } } catch (err) { console.error('[livechatWindowTitlePlugin] Failed updating the window title', err)