Merge branch 'connect-empty-address-fix' into 'master'

Fixed "invalid pointer" error when passing "" to Command_connect().

See merge request STJr/SRB2!234
This commit is contained in:
Monster Iestyn 2018-04-21 17:32:50 -04:00
commit 452aef4981
2 changed files with 8 additions and 1 deletions

View file

@ -2244,7 +2244,7 @@ static void Command_connect(void)
// Assume we connect directly. // Assume we connect directly.
boolean viams = false; boolean viams = false;
if (COM_Argc() < 2) if (COM_Argc() < 2 || *COM_Argv(1) == 0)
{ {
CONS_Printf(M_GetText( CONS_Printf(M_GetText(
"Connect <serveraddress> (port): connect to a server\n" "Connect <serveraddress> (port): connect to a server\n"

View file

@ -6295,6 +6295,13 @@ static void M_DrawConnectIPMenu(void)
static void M_ConnectIP(INT32 choice) static void M_ConnectIP(INT32 choice)
{ {
(void)choice; (void)choice;
if (*setupm_ip == 0)
{
M_StartMessage("You must specify an IP address.\n", NULL, MM_NOTHING);
return;
}
COM_BufAddText(va("connect \"%s\"\n", setupm_ip)); COM_BufAddText(va("connect \"%s\"\n", setupm_ip));
// A little "please wait" message. // A little "please wait" message.