From ce11021e9fcc45c61f72713b58bbcc7f1fbba180 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Thu, 30 Apr 2020 16:40:17 +1000 Subject: [PATCH] Fix bug with dropping token onto empty map --- src/components/token/ProxyToken.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/token/ProxyToken.js b/src/components/token/ProxyToken.js index a690bec..0ed984d 100644 --- a/src/components/token/ProxyToken.js +++ b/src/components/token/ProxyToken.js @@ -110,8 +110,8 @@ function ProxyToken({ } let proxy = proxyRef.current; if (proxy) { - if (onProxyDragEnd) { - const mapImage = document.querySelector(".mapImage"); + const mapImage = document.querySelector(".mapImage"); + if (onProxyDragEnd && mapImage) { const mapImageRect = mapImage.getBoundingClientRect(); let x = parseFloat(proxy.getAttribute("data-x")) || 0;