[gnome-shell] layout: Range-check index before array lookup
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] layout: Range-check index before array lookup
- Date: Thu, 13 Jul 2017 15:26:23 +0000 (UTC)
commit 1ba014d9dba9b1884d7c889fb726eeeca6ff0634
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Jun 13 05:39:06 2017 +0200
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 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index aaf9da5..b1e7f94 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() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]