Skip to content

Commit

Permalink
model range fix
Browse files Browse the repository at this point in the history
Use the correct upper bounds check for `model_get()`.
  • Loading branch information
Goober5000 committed Apr 11, 2024
1 parent 71543c9 commit 7fba753
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/model/modelread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3842,7 +3842,7 @@ polymodel * model_get(int model_num)
Assertion( Polygon_models[num], "No model with id %d found. Please backtrace and investigate.\n", num );
Assertion( Polygon_models[num]->id == model_num, "Index collision between model %s and requested model %d. Please backtrace and investigate.\n", Polygon_models[num]->filename, model_num );

if (num < 0 || num > MAX_POLYGON_MODELS || !Polygon_models[num] || Polygon_models[num]->id != model_num)
if (num < 0 || num >= MAX_POLYGON_MODELS || !Polygon_models[num] || Polygon_models[num]->id != model_num)
return NULL;

return Polygon_models[num];
Expand Down

0 comments on commit 7fba753

Please sign in to comment.