svn commit: r329414 - head/stand/lua

Kyle Evans kevans at FreeBSD.org
Fri Feb 16 22:51:09 UTC 2018


Author: kevans
Date: Fri Feb 16 22:51:08 2018
New Revision: 329414
URL: https://svnweb.freebsd.org/changeset/base/329414

Log:
  stand/lua: Don't try to divide by 0; do nothing

Modified:
  head/stand/lua/menu.lua

Modified: head/stand/lua/menu.lua
==============================================================================
--- head/stand/lua/menu.lua	Fri Feb 16 22:17:30 2018	(r329413)
+++ head/stand/lua/menu.lua	Fri Feb 16 22:51:08 2018	(r329414)
@@ -297,9 +297,11 @@ function menu.run(m)
 				local caridx = menu.getCarouselIndex(carid);
 				local choices = sel_entry.items();
 
-				caridx = (caridx % #choices) + 1;
-				menu.setCarouselIndex(carid, caridx);
-				sel_entry.func(choices[caridx]);
+				if (#choices > 0) then
+					caridx = (caridx % #choices) + 1;
+					menu.setCarouselIndex(carid, caridx);
+					sel_entry.func(choices[caridx]);
+				end
 			elseif (sel_entry.entry_type == core.MENU_SUBMENU) then
 				-- recurse
 				cont = menu.run(sel_entry.submenu());


More information about the svn-src-all mailing list