From 4c6e5607fb6ded472f5b3513145dbaa75c184c2f Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Tue, 15 Dec 2020 18:16:59 +0100 Subject: [PATCH] Check if player has widget before trying to focus it --- clapper_src/headerbarBase.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/clapper_src/headerbarBase.js b/clapper_src/headerbarBase.js index 09d32b40..6eed791c 100644 --- a/clapper_src/headerbarBase.js +++ b/clapper_src/headerbarBase.js @@ -123,7 +123,13 @@ class ClapperHeaderBarPopover extends Gtk.PopoverMenu let root = this.get_root(); let clapperWidget = root.get_child(); - if(clapperWidget && clapperWidget.player) - clapperWidget.player.widget.grab_focus(); + if( + !clapperWidget + || !clapperWidget.player + || !clapperWidget.player.widget + ) + return; + + clapperWidget.player.widget.grab_focus(); } });