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
This commit is contained in:
David Anderson 2006-06-06 07:00:27 +00:00
parent eba189e2b9
commit e0f1a93d6e
2 changed files with 2 additions and 1 deletions

View File

@ -997,6 +997,7 @@ int loadModules(const char* filename, PLUG_LOADTIME now)
while (!feof(fp)) while (!feof(fp))
{ {
buffer[0] = '\0';
fgets(buffer, sizeof(buffer)-1, fp); fgets(buffer, sizeof(buffer)-1, fp);
if (buffer[0] == ';' || buffer[0] == '\n') if (buffer[0] == ';' || buffer[0] == '\n')

View File

@ -151,7 +151,7 @@ int Menu::PagekeyToItem(page_t page, item_t key)
if (num_pages == 1 || !items_per_page) if (num_pages == 1 || !items_per_page)
{ {
if (m_AlwaysExit && key > m_Items.size()) if (m_AlwaysExit || key >= m_Items.size())
return MENU_EXIT; return MENU_EXIT;
else else
return key-1; return key-1;