Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More crash prevention #3657

Merged
merged 3 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,11 @@ static void renderExplosionEffect(const EFFECT *psEffect, const glm::mat4 &viewM
{
const PIELIGHT brightness = WZCOL_WHITE;

if (psEffect == nullptr || psEffect->imd == nullptr)
{
return;
}

if (psEffect->type == EXPLOSION_TYPE_LAND_LIGHT)
{
if (rejectLandLight((LAND_LIGHT_SPEC)psEffect->specific))
Expand Down
1 change: 1 addition & 0 deletions src/order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2037,6 +2037,7 @@ void orderDroidObj(DROID *psDroid, DROID_ORDER order, BASE_OBJECT *psObj, QUEUE_
{
ASSERT(psDroid != nullptr, "Invalid unit pointer");
ASSERT(validOrderForObj(order), "Invalid order for object");
ASSERT_OR_RETURN(, psObj != nullptr, "Invalid object pointer");
ASSERT_OR_RETURN(, !isBlueprint(psObj), "Target %s is a blueprint", objInfo(psObj));
ASSERT_OR_RETURN(, !psObj->died, "Target dead");

Expand Down
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
Loading