NULL checks

This commit is contained in:
Alam Ed Arias 2016-06-13 10:07:10 -04:00
parent 4d6a3e3398
commit 2c8008e11e
5 changed files with 18 additions and 10 deletions

View file

@ -732,6 +732,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
luaG_runerror(L, LUA_QL("for") " limit must be a number"); luaG_runerror(L, LUA_QL("for") " limit must be a number");
else if (!tonumber(pstep, ra+2)) else if (!tonumber(pstep, ra+2))
luaG_runerror(L, LUA_QL("for") " step must be a number"); luaG_runerror(L, LUA_QL("for") " step must be a number");
if (ra && pstep)
setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep))); setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep)));
dojump(L, pc, GETARG_sBx(i)); dojump(L, pc, GETARG_sBx(i));
continue; continue;

View file

@ -966,9 +966,11 @@ void CV_RegisterVar(consvar_t *variable)
// check net variables // check net variables
if (variable->flags & CV_NETVAR) if (variable->flags & CV_NETVAR)
{ {
const consvar_t *netvar;
variable->netid = CV_ComputeNetid(variable->name); variable->netid = CV_ComputeNetid(variable->name);
if (CV_FindNetVar(variable->netid)) netvar = CV_FindNetVar(variable->netid);
I_Error("Variables %s and %s have same netid\n", variable->name, CV_FindNetVar(variable->netid)->name); if (netvar)
I_Error("Variables %s and %s have same netid\n", variable->name, netvar->name);
} }
// link the variable in // link the variable in

View file

@ -4529,6 +4529,7 @@ static void HWR_SortVisSprites(void)
// Fix first and last. ds still points to the last one after the loop // Fix first and last. ds still points to the last one after the loop
dsfirst->prev = &unsorted; dsfirst->prev = &unsorted;
unsorted.next = dsfirst; unsorted.next = dsfirst;
if (ds)
ds->next = &unsorted; ds->next = &unsorted;
unsorted.prev = ds; unsorted.prev = ds;
@ -4552,10 +4553,13 @@ static void HWR_SortVisSprites(void)
best = ds; best = ds;
} }
} }
if (best)
{
best->next->prev = best->prev; best->next->prev = best->prev;
best->prev->next = best->next; best->prev->next = best->next;
best->next = &gr_vsprsortedhead; best->next = &gr_vsprsortedhead;
best->prev = gr_vsprsortedhead.prev; best->prev = gr_vsprsortedhead.prev;
}
gr_vsprsortedhead.prev->next = best; gr_vsprsortedhead.prev->next = best;
gr_vsprsortedhead.prev = best; gr_vsprsortedhead.prev = best;
} }

View file

@ -1928,7 +1928,7 @@ static inline void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 du
//pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency //pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
// Remove depth mask when the model is transparent so it doesn't cut thorugh sprites // SRB2CBTODO: For all stuff too?! // Remove depth mask when the model is transparent so it doesn't cut thorugh sprites // SRB2CBTODO: For all stuff too?!
if (color[3] < 255) if (color && color[3] < 255)
{ {
pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
pglDepthMask(GL_FALSE); pglDepthMask(GL_FALSE);

View file

@ -1634,6 +1634,7 @@ void R_SortVisSprites(void)
// Fix first and last. ds still points to the last one after the loop // Fix first and last. ds still points to the last one after the loop
dsfirst->prev = &unsorted; dsfirst->prev = &unsorted;
unsorted.next = dsfirst; unsorted.next = dsfirst;
if (ds)
ds->next = &unsorted; ds->next = &unsorted;
unsorted.prev = ds; unsorted.prev = ds;