From 17cd1fee96dcaa13fc5a12f2e1bcf3bd68fc335e Mon Sep 17 00:00:00 2001 From: Gian Hancock Date: Thu, 12 Dec 2024 21:52:45 +1100 Subject: [PATCH] Validate arg count for OR function To be compatible with Excel, at least 1 argument is required. Fixes #175 --- base/src/functions/logical.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/base/src/functions/logical.rs b/base/src/functions/logical.rs index 8aade89..7ab2736 100644 --- a/base/src/functions/logical.rs +++ b/base/src/functions/logical.rs @@ -136,6 +136,9 @@ impl Model { } pub(crate) fn fn_or(&mut self, args: &[Node], cell: CellReferenceIndex) -> CalcResult { + if args.is_empty() { + return CalcResult::new_args_number_error(cell); + } let mut result = false; for arg in args { match self.evaluate_node_in_context(arg, cell) {