Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Feb 2018 22:51:08 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329414 - head/stand/lua
Message-ID:  <201802162251.w1GMp8Bd079849@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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());



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802162251.w1GMp8Bd079849>