From 07625c7bb82c653824b5a15c0432d360ecd39c28 Mon Sep 17 00:00:00 2001 From: Fabian Homborg <FHomborg@gmail.com> Date: Sun, 10 Nov 2013 21:44:34 +0100 Subject: [PATCH] HalfLayout: Bail early when trying to remove invalid tileindex --- contents/code/halflayout.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contents/code/halflayout.js b/contents/code/halflayout.js index c8a5710..898da03 100644 --- a/contents/code/halflayout.js +++ b/contents/code/halflayout.js @@ -111,6 +111,10 @@ HalfLayout.prototype.removeTile = function(tileIndex) { //FIXME: There is a crash here // Remove the array entry var oldrect = this.tiles[tileIndex].rectangle; + if (tileIndex < 0 || tileIndex >= this.tiles.length) { + print("Removing invalid tileindex"); + return; + } this.tiles.splice(tileIndex, 1); // Update the other tiles if (this.tiles.length == 1) { -- GitLab