From 8f064c9e40f41169e3d175628be7b2644110082c Mon Sep 17 00:00:00 2001 From: jenzur Date: Tue, 14 Apr 2020 01:06:36 +0200 Subject: [PATCH] rowcount check --- .../scripting/unloze_ingame_poll_css_redux.sp | 52 +++++++++++-------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/unloze_poll_votes/scripting/unloze_ingame_poll_css_redux.sp b/unloze_poll_votes/scripting/unloze_ingame_poll_css_redux.sp index 512adea8..8653631c 100644 --- a/unloze_poll_votes/scripting/unloze_ingame_poll_css_redux.sp +++ b/unloze_poll_votes/scripting/unloze_ingame_poll_css_redux.sp @@ -411,13 +411,16 @@ public void mysql_enable_disable_poll(int iclient6, char []table_name_enable) delete rs_disable; return; } - rs_disable.FetchRow(); - int status = rs_disable.FetchInt(0); - delete rs_disable; - if (status) - PrintToChat(iclient6, "Enabled poll %s", table_name_enable); - else - PrintToChat(iclient6, "Disabled poll %s", table_name_enable); + if (rs_disable.RowCount > 0) + { + rs_disable.FetchRow(); + int status = rs_disable.FetchInt(0); + delete rs_disable; + if (status) + PrintToChat(iclient6, "Enabled poll %s", table_name_enable); + else + PrintToChat(iclient6, "Disabled poll %s", table_name_enable); + } editpoll(iclient6, table_name_enable); } @@ -687,22 +690,25 @@ public void mysql_playtime_requirement(int client, char []info) delete rs; return; } - int playtime; - rs.FetchRow(); - playtime = rs.FetchInt(0); - PrintToChat(client, "playtime required: %i", playtime); - admin_editing[client] = 7; - Menu menu = new Menu(editpollmenu, MENU_ACTIONS_ALL); - menu.SetTitle("Poll %s has playtime requirement: %i", "", info, playtime); - menu.AddItem("0", "0 hours playtime requirement"); - menu.AddItem("5", "5 hours playtime requirement"); - menu.AddItem("10", "10 hours playtime requirement"); - menu.AddItem("25", "25 hours playtime requirement"); - menu.AddItem("50", "50 hours playtime requirement"); - menu.AddItem("250", "250 hours playtime requirement"); - menu.AddItem("1000", "1000 hours playtime requirement"); - menu.ExitButton = true; - menu.Display(client, MENU_TIME_FOREVER); + if (rs.RowCount > 0) + { + int playtime; + rs.FetchRow(); + playtime = rs.FetchInt(0); + PrintToChat(client, "playtime required: %i", playtime); + admin_editing[client] = 7; + Menu menu = new Menu(editpollmenu, MENU_ACTIONS_ALL); + menu.SetTitle("Poll %s has playtime requirement: %i", "", info, playtime); + menu.AddItem("0", "0 hours playtime requirement"); + menu.AddItem("5", "5 hours playtime requirement"); + menu.AddItem("10", "10 hours playtime requirement"); + menu.AddItem("25", "25 hours playtime requirement"); + menu.AddItem("50", "50 hours playtime requirement"); + menu.AddItem("250", "250 hours playtime requirement"); + menu.AddItem("1000", "1000 hours playtime requirement"); + menu.ExitButton = true; + menu.Display(client, MENU_TIME_FOREVER); + } delete rs; }