From db07aa42ea1b2a0ed702252a753122739fdcd1b2 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 4 Sep 2013 01:22:46 +0200 Subject: [PATCH] panel: fix crash when bluetooth is disabled https://bugzilla.gnome.org/show_bug.cgi?id=707430 --- js/ui/panel.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/js/ui/panel.js b/js/ui/panel.js index aaabad1a9..c6c1abc75 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -809,7 +809,12 @@ const AggregateMenu = new Lang.Class({ this.actor.add_child(this._indicators); this._network = new imports.ui.status.network.NMApplet(); - this._bluetooth = new imports.ui.status.bluetooth.Indicator(); + if (Config.HAVE_BLUETOOTH) { + this._bluetooth = new imports.ui.status.bluetooth.Indicator(); + } else { + this._bluetooth = null; + } + this._power = new imports.ui.status.power.Indicator(); this._rfkill = new imports.ui.status.rfkill.Indicator(); this._volume = new imports.ui.status.volume.Indicator(); @@ -819,7 +824,9 @@ const AggregateMenu = new Lang.Class({ this._indicators.add_child(this._screencast.indicators); this._indicators.add_child(this._network.indicators); - this._indicators.add_child(this._bluetooth.indicators); + if (this._bluetooth) { + this._indicators.add_child(this._bluetooth.indicators); + } this._indicators.add_child(this._rfkill.indicators); this._indicators.add_child(this._volume.indicators); this._indicators.add_child(this._power.indicators); @@ -831,7 +838,9 @@ const AggregateMenu = new Lang.Class({ this.menu.addMenuItem(this._brightness.menu); this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); this.menu.addMenuItem(this._network.menu); - this.menu.addMenuItem(this._bluetooth.menu); + if (this._bluetooth) { + this.menu.addMenuItem(this._bluetooth.menu); + } this.menu.addMenuItem(this._rfkill.menu); this.menu.addMenuItem(this._power.menu); this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());