From aa83da32321e05ca402f30f249ac88504c45d0c9 Mon Sep 17 00:00:00 2001 From: milan Date: Wed, 4 Dec 2024 12:04:53 +0100 Subject: [PATCH] remove jserror on undefined variable --- api/js/etemplate/et2_widget_htmlarea.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_widget_htmlarea.ts b/api/js/etemplate/et2_widget_htmlarea.ts index 5632edbf68..7f0351334e 100644 --- a/api/js/etemplate/et2_widget_htmlarea.ts +++ b/api/js/etemplate/et2_widget_htmlarea.ts @@ -597,7 +597,8 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable }); // TinyMCE inserts a BR in the first P --> remove it, if it's not the only child, as it is not wanted (moves the text down on each submit) const firstChild = body.firstChild; - if (firstChild.nodeName === 'P' && firstChild.firstChild !== firstChild.lastChild && firstChild.firstChild.nodeName === 'BR') + + if (firstChild && firstChild.nodeName === 'P' && firstChild.firstChild !== firstChild.lastChild && firstChild.firstChild.nodeName === 'BR') { firstChild.removeChild(firstChild.firstChild); }