Quantcast

Fix checkbox and list item checks in parameter lists.

Johnny C. Lam [07-14-14 - 01:21]
Fix checkbox and list item checks in parameter lists.

* A checkbox is only true if it is actually true, not just non-nil.
* If any check fails, then fail immediately.  Before this was allowing any
  checkbox condition to be true as long as one of them was true.
Filename
OvaleCompile.lua
diff --git a/OvaleCompile.lua b/OvaleCompile.lua
index 60be45b..27693c6 100644
--- a/OvaleCompile.lua
+++ b/OvaleCompile.lua
@@ -137,8 +137,11 @@ local function TestConditions(parameters)
 				Ovale.casesACocher[name] = control
 				-- Check the value of the checkbox.
 				profile = profile or OvaleOptions:GetProfile()
-				local isChecked = (profile.check[name] ~= nil)
+				local isChecked = profile.check[name]
 				boolean = (required and isChecked) or (not required and not isChecked)
+				if not boolean then
+					break
+				end
 			end
 		end
 		if boolean and parameters.listitem then
@@ -151,6 +154,9 @@ local function TestConditions(parameters)
 				profile = profile or OvaleOptions:GetProfile()
 				local isSelected = (profile.list[list] == item)
 				boolean = (required and isSelected) or (not required and not isSelected)
+				if not boolean then
+					break
+				end
 			end
 		end
 	end