From 43d0dc528fb06803eadfa0a48000923887ff8540 Mon Sep 17 00:00:00 2001 From: varjolintu Date: Sat, 29 Nov 2025 14:04:07 +0200 Subject: [PATCH] Fix using invalid parameters with MutationObserver --- keepassxc-browser/content/ui.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/keepassxc-browser/content/ui.js b/keepassxc-browser/content/ui.js index e3a6d4a..1a77d3c 100644 --- a/keepassxc-browser/content/ui.js +++ b/keepassxc-browser/content/ui.js @@ -431,8 +431,12 @@ kpxcUI.createPageObserver = function() { } }); - kpxcUI.pageObserver.observe(document.documentElement, OBSERVER_OPTIONS); - kpxcUI.pageObserver.observe(document.body, OBSERVER_OPTIONS); + if (document?.documentElement) { + kpxcUI.pageObserver.observe(document.documentElement, OBSERVER_OPTIONS); + } + if (document?.body) { + kpxcUI.pageObserver.observe(document.body, OBSERVER_OPTIONS); + } }; const DOMRectToArray = function(domRect) {