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:
hendricks266 2015-03-29 02:40:03 +00:00
parent 47ddef2521
commit d49987d3cb

View file

@ -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;