Skip to content

Commit

Permalink
Potential fix for concurrent modification crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry282 committed Aug 13, 2024
1 parent 230515f commit 2645218
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/main/kotlin/funnymap/utils/MapUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ object MapUtils {

fun updateMapData(packet: S34PacketMaps) {
if (!inDungeons) return
val map = getMapItem()
if (map != null) {
mapData = (map.item as ItemMap).getMapData(map, mc.theWorld)
}
if (mapData == null) {
mapData = MapData("map_${packet.mapId}")
Utils.runMinecraftThread {
val map = getMapItem()
if (map != null) {
mapData = (map.item as ItemMap).getMapData(map, mc.theWorld)
}
if (mapData == null) {
mapData = MapData("map_${packet.mapId}")
}
packet.setMapdataTo(mapData)
}
packet.setMapdataTo(mapData)
}

/**
Expand Down

0 comments on commit 2645218

Please sign in to comment.