Validate arg count for OR function

To be compatible with Excel, at least 1 argument is required.

Fixes #175
This commit is contained in:
Gian Hancock
2024-12-12 21:52:45 +11:00
committed by Nicolás Hatcher Andrés
parent c59148bdf6
commit 17cd1fee96

View File

@@ -136,6 +136,9 @@ impl Model {
} }
pub(crate) fn fn_or(&mut self, args: &[Node], cell: CellReferenceIndex) -> CalcResult { 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; let mut result = false;
for arg in args { for arg in args {
match self.evaluate_node_in_context(arg, cell) { match self.evaluate_node_in_context(arg, cell) {