From 52833f6285b4fd7a710db09aaea77c795a107f8f Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Fri, 6 Feb 2015 01:00:51 -0500 Subject: [PATCH] check cell before sending commands --- js/models/Lattice.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/models/Lattice.js b/js/models/Lattice.js index 4f89f69b..adf864fb 100644 --- a/js/models/Lattice.js +++ b/js/models/Lattice.js @@ -147,7 +147,8 @@ Lattice = Backbone.Model.extend({ zHeight = Math.floor(zHeight/zScale); for (var z=0;z<zHeight;z++){ - cells[x][y][z].destroy(); + var cell = cells[x][y][z]; + if (cell) cell.destroy(); cells[x][y][z] = null; } } -- GitLab