Skip to content

Commit

Permalink
Make binding deserialization more resilient
Browse files Browse the repository at this point in the history
  • Loading branch information
Speykious committed Oct 1, 2024
1 parent cb35c5b commit 8ff6980
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion inox2d/src/formats/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,15 @@ fn deserialize_param(obj: JsonObject) -> InoxParseResult<(String, Param)> {
fn deserialize_bindings(vals: &[json::JsonValue]) -> InoxParseResult<Vec<Binding>> {
let mut bindings = Vec::new();
for val in vals {
bindings.push(deserialize_binding(as_object("binding", val)?)?);
let Ok(binding_object) = as_object("binding", val) else {
tracing::error!("Encountered binding that is not a JSON object, ignoring");
continue;
};

match deserialize_binding(binding_object) {
Ok(binding) => bindings.push(binding),
Err(e) => tracing::error!("Invalid binding: {e}"),
}
}

Ok(bindings)
Expand Down

0 comments on commit 8ff6980

Please sign in to comment.