mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
C-CON: Add checks to prevent invalid reads/writes when using get/setprojectile on a tile number that does not have a projectile defined for it.
git-svn-id: https://svn.eduke32.com/eduke32@5110 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
47ddef2521
commit
d49987d3cb
1 changed files with 12 additions and 0 deletions
|
@ -1218,6 +1218,12 @@ int32_t __fastcall VM_GetProjectile(register int32_t const iTile, register int32
|
|||
|
||||
projectile_t * const proj = g_tile[iTile].proj;
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE(!proj))
|
||||
{
|
||||
CON_ERRPRINTF("VM_GetProjectile: no projectile defined for tile %d\n", iTile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (lLabelID)
|
||||
{
|
||||
case PROJ_WORKSLIKE: lLabelID = proj->workslike; break;
|
||||
|
@ -1266,6 +1272,12 @@ void __fastcall VM_SetProjectile(register int32_t const iTile, register int32_t
|
|||
|
||||
projectile_t * const proj = g_tile[iTile].proj;
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE(!proj))
|
||||
{
|
||||
CON_ERRPRINTF("VM_SetProjectile: no projectile defined for tile %d\n", iTile);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (lLabelID)
|
||||
{
|
||||
case PROJ_WORKSLIKE: proj->workslike = iSet; break;
|
||||
|
|
Loading…
Reference in a new issue