From b64d3f4deb809e2b0c1c109e414e1a48adfcb455 Mon Sep 17 00:00:00 2001 From: localcc Date: Tue, 29 Aug 2023 10:37:59 +0200 Subject: [PATCH] unreal_asset: [kismet] fix KismetExpression read_arr error propagation fixes #96 --- unreal_asset/unreal_asset_kismet/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/unreal_asset/unreal_asset_kismet/src/lib.rs b/unreal_asset/unreal_asset_kismet/src/lib.rs index 7c90314..2a189cf 100644 --- a/unreal_asset/unreal_asset_kismet/src/lib.rs +++ b/unreal_asset/unreal_asset_kismet/src/lib.rs @@ -1106,12 +1106,12 @@ impl KismetExpression { end_token: EExprToken, ) -> Result, Error> { let mut data = Vec::new(); - let mut current_expr: Option = None; - while current_expr.is_none() || !current_expr.as_ref().unwrap().enum_eq(&end_token) { - if let Some(expr) = current_expr { - data.push(expr); + loop { + let expr = KismetExpression::new(asset)?; + if expr.enum_eq(&end_token) { + break; } - current_expr = KismetExpression::new(asset).ok(); + data.push(expr); } Ok(data) }