quick and dirty solution deployed for the load screen dereferencing the dead pointer

This commit is contained in:
minjaesong
2021-09-18 11:55:38 +09:00
parent 2f19d2cd51
commit 43d9785db8
4 changed files with 27 additions and 27 deletions

View File

@@ -208,14 +208,7 @@ open class GameWorld() : Disposable {
*/
fun getTileFromWall(rawX: Int, rawY: Int): ItemID {
val (x, y) = coerceXY(rawX, rawY)
try {
return tileNumberToNameMap[layerWall.unsafeGetTile(x, y).toLong()]!!
}
catch (e: NullPointerException) {
val msg = "No tile name mapping for wall ${layerWall.unsafeGetTile(x, y)} in ($x, $y) from $layerWall"
throw NoSuchElementException(msg)
}
return tileNumberToNameMap[layerWall.unsafeGetTile(x, y).toLong()] ?: throw NoSuchElementException("No tile name mapping for wall ${layerWall.unsafeGetTile(x, y)} in ($x, $y) from $layerWall")
}
/**
@@ -223,14 +216,7 @@ open class GameWorld() : Disposable {
*/
fun getTileFromTerrain(rawX: Int, rawY: Int): ItemID {
val (x, y) = coerceXY(rawX, rawY)
try {
return tileNumberToNameMap[layerTerrain.unsafeGetTile(x, y).toLong()]!!
}
catch (e: NullPointerException) {
val msg = "No tile name mapping for terrain ${layerTerrain.unsafeGetTile(x, y)} in ($x, $y) from $layerTerrain"
throw NoSuchElementException(msg)
}
return tileNumberToNameMap[layerTerrain.unsafeGetTile(x, y).toLong()] ?: throw NoSuchElementException("No tile name mapping for terrain ${layerTerrain.unsafeGetTile(x, y)} in ($x, $y) from $layerTerrain")
}
/**