[FIX] web_editor: prevent traceback on get Powerbox element

Whenever using the `getPowerboxElement`, it is possible to have a
null node.

closes odoo/odoo#75163

X-original-commit: 03d7021b251d31cfda055c6ffe9684fad191903c
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
This commit is contained in:
Nicolas Bayet
2021-08-16 15:24:35 +00:00
parent 6b89b53b63
commit e41eebd7a8
@@ -85,7 +85,7 @@ const Wysiwyg = Widget.extend({
const selection = document.getSelection();
if (selection.isCollapsed && selection.rangeCount) {
const node = closestElement(selection.anchorNode, 'P, DIV');
return !(node.hasAttribute && node.hasAttribute('data-oe-model')) && node;
return !(node && node.hasAttribute && node.hasAttribute('data-oe-model')) && node;
}
},
isHintBlacklisted: node => {