diff --git a/src/sbbs3/prntfile.cpp b/src/sbbs3/prntfile.cpp index 93d339a4ff48dd08e31a34fd09f09cacaddfd274..caf470b4d592e6bde3d03d8168c089600c02f968 100644 --- a/src/sbbs3/prntfile.cpp +++ b/src/sbbs3/prntfile.cpp @@ -388,11 +388,15 @@ bool sbbs_t::random_menu(const char *name, int mode, JSObject* obj) strListDedupe(&names, /* case_sensitive: */ true); bool result = false; size_t count = strListCount(names); - if (count > 0) { + while (count > 0) { size_t i = sbbs_random(count); if (menu_exists(names[i], NULL, path)) { result = menu(names[i], mode, obj); + if (result == true) + break; } + strListFastDelete(names, i, 1); + --count; } strListFree(&names); return result;