From fd9f47e41e38a0ee1dd3c361b52ee08f91d8a1b2 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Mon, 4 Jan 2021 12:22:09 +1100 Subject: [PATCH] Added check for stage in drag overlay --- src/components/DragOverlay.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/DragOverlay.js b/src/components/DragOverlay.js index 18678e7..a89f02d 100644 --- a/src/components/DragOverlay.js +++ b/src/components/DragOverlay.js @@ -16,8 +16,11 @@ function DragOverlay({ dragging, node, onRemove }) { if (!node || !dragging || !removeTokenRef.current) { return; } - - const pointerPosition = node.getStage().getPointerPosition(); + const stage = node.getStage(); + if (!stage) { + return; + } + const pointerPosition = stage.getPointerPosition(); const screenSpacePointerPosition = { x: pointerPosition.x + mapRect.left, y: pointerPosition.y + mapRect.top,