From 367a0ddbf9abb4cf0a016bd62d7f4cb1e7d85d24 Mon Sep 17 00:00:00 2001 From: bordun Date: Sun, 22 Nov 2020 18:05:18 +0100 Subject: [PATCH] modal/button: prevent error when `label` is updated before the widget is fully created --- CHANGELOG.md | 1 + src/client/widgets/basics/button.js | 2 ++ src/client/widgets/containers/modal.js | 2 ++ 3 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87699c0b..18507e64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - bug fixes - custom module / theme: prevent reloading the module while the file is being written to + - modal/button: prevent error when `label` is updated - widgets - encoder: add `ticks` property back diff --git a/src/client/widgets/basics/button.js b/src/client/widgets/basics/button.js index 19b736c5..cd334012 100644 --- a/src/client/widgets/basics/button.js +++ b/src/client/widgets/basics/button.js @@ -202,6 +202,8 @@ class Button extends Widget { updateLabel() { + if (!this.label) return + if (this.getProp('label') === false) { if (this.widget.contains(this.label)) this.widget.removeChild(this.label) diff --git a/src/client/widgets/containers/modal.js b/src/client/widgets/containers/modal.js index 06ec8edf..453ef2c2 100644 --- a/src/client/widgets/containers/modal.js +++ b/src/client/widgets/containers/modal.js @@ -207,6 +207,8 @@ class Modal extends Panel { updateLabel() { + if (!this.label) return + if (this.getProp('label') === false) { if (this.container.contains(this.label)) this.container.removeChild(this.label)