fix warnings

This commit is contained in:
Jaime Passos 2019-12-19 02:20:49 -03:00
parent 019e52a4f4
commit ebdd9c6257
2 changed files with 5 additions and 2 deletions

View file

@ -3220,7 +3220,8 @@ void G_UpdateGametypeSelections(void)
//
void G_SetGametypeDescription(INT16 gtype, char *descriptiontext, UINT8 leftcolor, UINT8 rightcolor)
{
strncpy(gametypedesc[gtype].notes, descriptiontext, 441);
if (descriptiontext != NULL)
strncpy(gametypedesc[gtype].notes, descriptiontext, 441);
gametypedesc[gtype].col[0] = leftcolor;
gametypedesc[gtype].col[1] = rightcolor;
}

View file

@ -24,6 +24,7 @@
#include "m_random.h"
#include "s_sound.h"
#include "g_game.h"
#include "m_menu.h"
#include "y_inter.h"
#include "hu_stuff.h" // HU_AddChatText
#include "console.h"
@ -2737,7 +2738,8 @@ static int lib_gAddGametype(lua_State *L)
// Add the new gametype
newgtidx = G_AddGametype(newgtrules);
G_AddGametypeTOL(newgtidx, newgttol);
G_SetGametypeDescription(newgtidx, (char *)gtdescription, newgtleftcolor, newgtrightcolor);
G_SetGametypeDescription(newgtidx, NULL, newgtleftcolor, newgtrightcolor);
strncpy(gametypedesc[newgtidx].notes, gtdescription, 441);
// Not covered by G_AddGametype alone.
if (newgtrankingstype == -1)