From 0e8e4a45d595da9ad1da615087be8e10fc6c94fb Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Tue, 21 Apr 2020 20:03:56 +1000 Subject: [PATCH] Added check for null gesture --- src/components/MapDrawing.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/components/MapDrawing.js b/src/components/MapDrawing.js index ba5ed01..2387eef 100644 --- a/src/components/MapDrawing.js +++ b/src/components/MapDrawing.js @@ -95,18 +95,20 @@ function MapDrawing({ ? pointsToGesture(simplifiedPoints) : "path"; - const data = - type === "path" - ? { points: simplifiedPoints } - : gestureToData(simplifiedPoints, type); + if (type !== null) { + const data = + type === "path" + ? { points: simplifiedPoints } + : gestureToData(simplifiedPoints, type); - onShapeAdd({ - type, - data, - id: shortid.generate(), - color: brushColor, - blend: useBrushBlending, - }); + onShapeAdd({ + type, + data, + id: shortid.generate(), + color: brushColor, + blend: useBrushBlending, + }); + } setBrushPoints([]); }