From 1ba014d9dba9b1884d7c889fb726eeeca6ff0634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 13 Jun 2017 05:39:06 +0200 Subject: [PATCH] layout: Range-check index before array lookup findMonitorForActor() may be called before the layoutManager gets to initialize monitors, so make sure the monitor index is in range to avoid a warning. https://bugzilla.gnome.org/show_bug.cgi?id=781471 --- js/ui/layout.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/ui/layout.js b/js/ui/layout.js index aaf9da536..b1e7f94b0 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -896,7 +896,10 @@ const LayoutManager = new Lang.Class({ }, findMonitorForActor: function(actor) { - return this.monitors[this.findIndexForActor(actor)]; + let index = this.findIndexForActor(actor); + if (index >= 0 && index < this.monitors.length) + return this.monitors[index]; + return null; }, _queueUpdateRegions: function() {