Add bounds check

This commit is contained in:
Kaelan 2024-10-15 19:37:16 -06:00 committed by Ricardo Luís Vaz Silva
parent 275635adc5
commit 4b3273b229

View file

@ -40,6 +40,7 @@
#include "r_sky.h" #include "r_sky.h"
#include "p_terrain.h" #include "p_terrain.h"
#include "p_effect.h" #include "p_effect.h"
#include "vm.h"
#include "hwrenderer/data/buffers.h" #include "hwrenderer/data/buffers.h"
@ -1031,11 +1032,13 @@ public:
void SetPlaneReflectivity(int pos, double val) void SetPlaneReflectivity(int pos, double val)
{ {
if (pos < 0 || pos > 1) ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "pos must be either 0 or 1");
reflect[pos] = val; reflect[pos] = val;
} }
double GetPlaneReflectivity(int pos) double GetPlaneReflectivity(int pos)
{ {
if (pos < 0 || pos > 1) ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "pos must be either 0 or 1");
return reflect[pos]; return reflect[pos];
} }