diff --git a/contents/code/tile.js b/contents/code/tile.js
index ec899cb7af8352b540866a27cae9d0549271bee3..95230495b7f36dd725b078c122c5fb34ef2f69ba 100644
--- a/contents/code/tile.js
+++ b/contents/code/tile.js
@@ -184,6 +184,9 @@ Tile.prototype.syncCustomProperties = function() {
 
 Tile.prototype.onClientGeometryChanged = function(client) {
 	try {
+		if (client == null) {
+			return;
+		}
 		if (!client.isCurrentTab) {
 			return;
 		}
diff --git a/contents/code/tilelist.js b/contents/code/tilelist.js
index abc523aff290dbeeb2861c7f01db8fe1d4d3efc3..fdbf60873c8b505ec5913a8af34fbad5ec3a7ba6 100644
--- a/contents/code/tilelist.js
+++ b/contents/code/tilelist.js
@@ -155,6 +155,9 @@ TileList.prototype.connectSignals = function(client) {
  * @param client Client which is added to the tile list.
  */
 TileList.prototype.addClient = function(client) {
+	if (client == null) {
+		return;
+	}
     if (TileList._isIgnored(client)) {
 		client.tileIndex = - 1;
         return;
@@ -300,13 +303,17 @@ TileList.prototype._addTile = function(client) {
 };
 
 TileList.prototype._removeTile = function(tileIndex) {
-    // Remove the tile if this was the last client in it
-	var tile = this.tiles[tileIndex];
-	this.tiles[tileIndex] = this.tiles[this.tiles.length - 1];
-	this.tiles[tileIndex].tileIndex = tileIndex;
-    this.tiles[tileIndex].syncCustomProperties();
-    this.tileRemoved.emit(tile);
-	this.tiles.length--;
+	try {
+		// Remove the tile if this was the last client in it
+		var tile = this.tiles[tileIndex];
+		this.tiles[tileIndex] = this.tiles[this.tiles.length - 1];
+		this.tiles[tileIndex].tileIndex = tileIndex;
+		this.tiles[tileIndex].syncCustomProperties();
+		this.tileRemoved.emit(tile);
+		this.tiles.length--;
+	} catch(err) {
+		print(err, "in TileList._removeTile");
+	}
 };
 
 /**
diff --git a/contents/code/tilingmanager.js b/contents/code/tilingmanager.js
index ca3a94d5c11017915c4c1f8d7757a01ae39c0763..24127b9b8ac05cbae51655c43e470ee875c45dfd 100644
--- a/contents/code/tilingmanager.js
+++ b/contents/code/tilingmanager.js
@@ -386,28 +386,32 @@ TilingManager.prototype._onTileMovingStarted = function(tile) {
 }
 
 TilingManager.prototype._onTileMovingEnded = function(tile) {
-	var client = tile.clients[0];
-	this._moving = false;
-	var movingEndScreen = client.screen;
-	var windowRect = client.geometry;
-	if (client.tiling_tileIndex >= 0) {
-		if (this._movingStartScreen != movingEndScreen) {
-			// Transfer the tile from one layout to another layout
-			var startLayout =
-				this.layouts[this._currentDesktop][this._movingStartScreen];
-			var endLayout = this.layouts[this._currentDesktop][client.screen];
-			startLayout.removeTile(tile);
-			endLayout.addTile(tile, windowRect.x + windowRect.width / 2,
-							  windowRect.y + windowRect.height / 2);
-		} else {
-			// Transfer the tile to a different location in the same layout
-			var layout = this.layouts[this._currentDesktop][client.screen];
-			var targetTile = layout.getTile(windowRect.x + windowRect.width / 2,
-											windowRect.y + windowRect.height / 2);
-			// swapTiles() works correctly even if tile == targetTile
-			layout.swapTiles(tile, targetTile);
+	try {
+		var client = tile.clients[0];
+		this._moving = false;
+		var movingEndScreen = client.screen;
+		var windowRect = client.geometry;
+		if (client.tiling_tileIndex >= 0) {
+			if (this._movingStartScreen != movingEndScreen) {
+				// Transfer the tile from one layout to another layout
+				var startLayout =
+					this.layouts[this._currentDesktop][this._movingStartScreen];
+				var endLayout = this.layouts[this._currentDesktop][client.screen];
+				startLayout.removeTile(tile);
+				endLayout.addTile(tile, windowRect.x + windowRect.width / 2,
+								  windowRect.y + windowRect.height / 2);
+			} else {
+				// Transfer the tile to a different location in the same layout
+				var layout = this.layouts[this._currentDesktop][client.screen];
+				var targetTile = layout.getTile(windowRect.x + windowRect.width / 2,
+												windowRect.y + windowRect.height / 2);
+				// swapTiles() works correctly even if tile == targetTile
+				layout.swapTiles(tile, targetTile);
+			}
+			workspace.hideOutline();
 		}
-		workspace.hideOutline();
+	} catch(err) {
+		print(err, "in TilingManager._onTileMovingEnded");
 	}
 }