Skip to content

Commit

Permalink
Fix crash that can occur due to invalid glow point bank (#5465)
Browse files Browse the repository at this point in the history
PR adds extra validity check within `model_render_glowpoints` function. Other places in code that use `bank->submodel_parent` check for validity before looking up `pmi->submodel`, but this check was missing from this section (which caused a CTD in a mission restart due to `bank->submodel_parent` being -1).
  • Loading branch information
wookieejedi authored Jun 19, 2023
1 parent f4aa5c0 commit f6b445e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/model/modelrender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2076,7 +2076,7 @@ void model_render_glow_points(polymodel *pm, polymodel_instance *pmi, ship *ship
if (bank->glow_bitmap == -1)
continue;

if (pmi != nullptr) {
if ((pmi != nullptr) && (bank->submodel_parent > -1)) {
auto smi = &pmi->submodel[bank->submodel_parent];
if (smi->blown_off) {
continue;
Expand Down

0 comments on commit f6b445e

Please sign in to comment.