Fix error when marker set is removed when changing between maps on the same world

This commit is contained in:
James Lyne 2022-02-23 13:58:32 +00:00
parent 61b2a59e2a
commit 61194c9c99

View File

@ -82,12 +82,15 @@ export default defineComponent({
watch(currentMap, (newValue, oldValue) => { watch(currentMap, (newValue, oldValue) => {
if(newValue && (!oldValue || oldValue.world === newValue.world)) { if(newValue && (!oldValue || oldValue.world === newValue.world)) {
//Prevent error if this marker set has just been removed due to the map change
if(nonReactiveState.markers.has(props.set.id)) {
converter = newValue.locationToLatLng.bind(newValue); converter = newValue.locationToLatLng.bind(newValue);
for (const [id, area] of nonReactiveState.markers.get(props.set.id)!) { for (const [id, area] of nonReactiveState.markers.get(props.set.id)!) {
updateMarkerLayer(layers.get(id), area, converter); updateMarkerLayer(layers.get(id), area, converter);
} }
} }
}
}); });
onMounted(() => { onMounted(() => {