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
This commit is contained in:
Florian Müllner 2017-06-13 05:39:06 +02:00
parent 1be2102d29
commit 70f1f2d7be

View File

@ -896,7 +896,10 @@ const LayoutManager = new Lang.Class({
}, },
findMonitorForActor: function(actor) { 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() { _queueUpdateRegions: function() {