mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-04-07 18:42:36 +00:00
Add bounds checking to GetMidTexturePosition, add assert to P_GetMidTexturePosition
This commit is contained in:
parent
2e795bebb4
commit
19e1d400e4
1 changed files with 5 additions and 0 deletions
|
@ -229,6 +229,8 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, do
|
|||
{
|
||||
if (line->sidedef[0]==NULL || line->sidedef[1]==NULL) return false;
|
||||
|
||||
assert(sideno >= 0 && sideno <= 1);
|
||||
|
||||
side_t *side = line->sidedef[sideno];
|
||||
FTextureID texnum = side->GetTexture(side_t::mid);
|
||||
if (!texnum.isValid()) return false;
|
||||
|
@ -266,6 +268,9 @@ DEFINE_ACTION_FUNCTION(_Line, GetMidTexturePosition)
|
|||
double top = 0.0;
|
||||
double bottom = 0.0;
|
||||
|
||||
if(side < 0) ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "side is negative");
|
||||
else if(side > 1) ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "side is greater than one");
|
||||
|
||||
bool res = P_GetMidTexturePosition(self,side,&top,&bottom);
|
||||
if (numret > 2) ret[2].SetFloat(bottom);
|
||||
if (numret > 1) ret[1].SetFloat(top);
|
||||
|
|
Loading…
Reference in a new issue