Skip to content
Snippets Groups Projects
Commit 5bbcffe6 authored by Lactozilla's avatar Lactozilla :speech_balloon:
Browse files

Ensure extracolormap_t is valid and that extra_colormap is invalidated

parent eb312949
No related branches found
No related tags found
No related merge requests found
......@@ -116,6 +116,9 @@ static int extracolormap_get(lua_State *L)
extracolormap_t *exc = *((extracolormap_t **)luaL_checkudata(L, 1, META_EXTRACOLORMAP));
enum extracolormap_e field = luaL_checkoption(L, 2, NULL, extracolormap_opt);
if (!exc)
return LUA_ErrInvalid(L, "extracolormap_t");
switch (field)
{
case extracolormap_red:
......@@ -198,6 +201,9 @@ static int extracolormap_set(lua_State *L)
extracolormap_t *exc = *((extracolormap_t **)luaL_checkudata(L, 1, META_EXTRACOLORMAP));
enum extracolormap_e field = luaL_checkoption(L, 2, NULL, extracolormap_opt);
if (!exc)
return LUA_ErrInvalid(L, "extracolormap_t");
UINT8 r = R_GetRgbaR(exc->rgba);
UINT8 g = R_GetRgbaG(exc->rgba);
UINT8 b = R_GetRgbaB(exc->rgba);
......
......@@ -892,6 +892,8 @@ void LUA_InvalidateLevel(void)
LUA_InvalidateUserdata(&sectors[i]);
LUA_InvalidateUserdata(&sectors[i].lines);
LUA_InvalidateUserdata(&sectors[i].tags);
if (sectors[i].extra_colormap)
LUA_InvalidateUserdata(sectors[i].extra_colormap);
if (sectors[i].ffloors)
{
for (rover = sectors[i].ffloors; rover; rover = rover->next)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment