From c74390196216ef22b78266ce90c28bc61fcc0e94 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Fri, 30 Oct 2020 11:57:36 +1100 Subject: [PATCH] Added check for map state in map state network update --- src/network/NetworkedMapAndTokens.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/network/NetworkedMapAndTokens.js b/src/network/NetworkedMapAndTokens.js index 9531ab6..0640690 100644 --- a/src/network/NetworkedMapAndTokens.js +++ b/src/network/NetworkedMapAndTokens.js @@ -365,31 +365,31 @@ function NetworkedMapAndTokens({ session }) { putToken(newToken); } } - if (id === "tokenStateEdit") { + if (id === "tokenStateEdit" && currentMapState) { setCurrentMapState((prevMapState) => ({ ...prevMapState, tokens: { ...prevMapState.tokens, ...data }, })); } - if (id === "tokenStateRemove") { + if (id === "tokenStateRemove" && currentMapState) { setCurrentMapState((prevMapState) => ({ ...prevMapState, tokens: omit(prevMapState.tokens, Object.keys(data)), })); } - if (id === "mapDraw") { + if (id === "mapDraw" && currentMapState) { addMapDrawActions(data, "mapDrawActionIndex", "mapDrawActions"); } - if (id === "mapDrawIndex") { + if (id === "mapDrawIndex" && currentMapState) { setCurrentMapState((prevMapState) => ({ ...prevMapState, mapDrawActionIndex: data, })); } - if (id === "mapFog") { + if (id === "mapFog" && currentMapState) { addMapDrawActions(data, "fogDrawActionIndex", "fogDrawActions"); } - if (id === "mapFogIndex") { + if (id === "mapFogIndex" && currentMapState) { setCurrentMapState((prevMapState) => ({ ...prevMapState, fogDrawActionIndex: data,