Skip to content

Commit

Permalink
Prevent crash in doWaveTerrain()
Browse files Browse the repository at this point in the history
  • Loading branch information
KJeff01 committed Feb 27, 2024
1 parent 90580d3 commit 35ecfff
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/visibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,14 @@ static inline void visMarkTile(const BASE_OBJECT *psObj, int mapX, int mapY, MAP
/* The terrain revealing ray callback */
static void doWaveTerrain(BASE_OBJECT *psObj)
{
if (psObj == nullptr)
{
return;
}

const int sx = psObj->pos.x;
const int sy = psObj->pos.y;
const int sz = psObj->pos.z + MAX(MIN_VIS_HEIGHT, psObj->sDisplay.imd->max.y);
const int sz = psObj->pos.z + ((psObj->sDisplay.imd != nullptr) ? MAX(MIN_VIS_HEIGHT, psObj->sDisplay.imd->max.y) : MIN_VIS_HEIGHT);
const unsigned radius = objSensorRange(psObj);
const int rayPlayer = psObj->player;
size_t size;
Expand Down

0 comments on commit 35ecfff

Please sign in to comment.