From e0f1a93d6e109babf3757e4eb454d58eaf82da1e Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 6 Jun 2006 07:00:27 +0000 Subject: [PATCH] fixed a bug where an empty modules file would crash fixed a bug where newmenu with default exit and a single page would not return MENU_EXIT on exit --- amxmodx/modules.cpp | 1 + amxmodx/newmenus.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/amxmodx/modules.cpp b/amxmodx/modules.cpp index ebe8c3b8..422be5d2 100755 --- a/amxmodx/modules.cpp +++ b/amxmodx/modules.cpp @@ -997,6 +997,7 @@ int loadModules(const char* filename, PLUG_LOADTIME now) while (!feof(fp)) { + buffer[0] = '\0'; fgets(buffer, sizeof(buffer)-1, fp); if (buffer[0] == ';' || buffer[0] == '\n') diff --git a/amxmodx/newmenus.cpp b/amxmodx/newmenus.cpp index 6faf1dbf..c31f775a 100755 --- a/amxmodx/newmenus.cpp +++ b/amxmodx/newmenus.cpp @@ -151,7 +151,7 @@ int Menu::PagekeyToItem(page_t page, item_t key) if (num_pages == 1 || !items_per_page) { - if (m_AlwaysExit && key > m_Items.size()) + if (m_AlwaysExit || key >= m_Items.size()) return MENU_EXIT; else return key-1;