diff --git a/crates/torin/src/values/size.rs b/crates/torin/src/values/size.rs index bfeb27e25..3e44bc2d1 100644 --- a/crates/torin/src/values/size.rs +++ b/crates/torin/src/values/size.rs @@ -322,6 +322,9 @@ impl<'a> DynamicCalculationEvaluator<'a> { // function should return on DynamicCalculation::ClosedParenthesis because it does // not have a precedence, thats how it actually works let val = self.parse_expression(0); + if self.current != Some(&DynamicCalculation::ClosedParenthesis) { + return None; + } self.current = self.calcs.next(); Some((val?, true)) } diff --git a/crates/torin/tests/size.rs b/crates/torin/tests/size.rs index 68b31b6b4..938006958 100644 --- a/crates/torin/tests/size.rs +++ b/crates/torin/tests/size.rs @@ -945,4 +945,16 @@ pub fn test_calc() { ), Some(-1.0 * 10.0 * 20.0) ); + + assert_eq!( + run_calculations( + &vec![ + DynamicCalculation::OpenParenthesis, + DynamicCalculation::Pixels(10.0), + ], + PARENT_VALUE, + PARENT_VALUE + ), + None + ); }