From 30cb3fbf55c43f2d5154f201c03d6f0f78e4180e Mon Sep 17 00:00:00 2001 From: Andrew Harvey Date: Thu, 28 Feb 2019 22:26:38 +1100 Subject: [PATCH] fix flow --- src/render/draw_debug.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/render/draw_debug.js b/src/render/draw_debug.js index b039bd457d9..58266cf6f10 100644 --- a/src/render/draw_debug.js +++ b/src/render/draw_debug.js @@ -40,7 +40,9 @@ function drawDebugTile(painter, sourceCache, coord) { debugUniformValues(posMatrix, Color.red), id, painter.debugBuffer, painter.tileBorderIndexBuffer, painter.debugSegments); - const tileSizeKb = Math.floor(sourceCache.getTileByID(coord.key).latestRawTileData && sourceCache.getTileByID(coord.key).latestRawTileData.byteLength / 1024); + const tileRawData = sourceCache.getTileByID(coord.key).latestRawTileData; + const tileByteLength = (tileRawData && tileRawData.byteLength) || 0; + const tileSizeKb = Math.floor(tileByteLength / 1024); const vertices = createTextVertices(`${coord.toString()} ${tileSizeKb}kb`, 50, 200, 5); const debugTextArray = new PosArray(); const debugTextIndices = new LineIndexArray();