From bed5f6437597f7c8909aed54d0d909c9d3b1bdae Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 10 Jan 2011 19:49:32 +0100 Subject: [PATCH] Fix 2 cases of menu crash in the server list when there are no servers: 1. inserting for example SPACE in the address inputbox and then focusing the Join button 2. right clicking on the list box --- qcsrc/menu/xonotic/serverlist.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qcsrc/menu/xonotic/serverlist.c b/qcsrc/menu/xonotic/serverlist.c index 3d5d3e843..0709d37c5 100644 --- a/qcsrc/menu/xonotic/serverlist.c +++ b/qcsrc/menu/xonotic/serverlist.c @@ -107,6 +107,8 @@ float IsFavorite(string srv) if(srv == "") return FALSE; srv = netaddress_resolve(srv, 26000); + if(srv == "") + return FALSE; p = crypto_getidfp(srv); n = tokenize_console(cvar_string("net_slist_favorites")); for(i = 0; i < n; ++i) @@ -707,8 +709,11 @@ float XonoticServerList_keyDown(entity me, float scan, float ascii, float shift) } else if(scan == K_MOUSE2 || scan == K_SPACE) { - main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem); - DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz); + if(me.nItems != 0) + { + main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem); + DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz); + } } else if(scan == K_INS || scan == K_MOUSE3 || scan == K_KP_INS) { -- 2.39.2