Skip to content

Commit

Permalink
fix: Specified attribute not found in the item error. (#261)
Browse files Browse the repository at this point in the history
Signed-off-by: pashifika <[email protected]>
  • Loading branch information
pashifika authored Sep 11, 2024
1 parent c30d587 commit 9ae3715
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,10 @@ fn convert_item_to_csv_line(
if keys_only {
} else if let Some(attrs) = attributes_to_append {
for attr /* String */ in attrs {
let attrval: &AttributeValue = item.iter().find(|x| x.0 == attr).expect("Specified attribute not found in the item.").1;
let attrval: &AttributeValue = match item.iter().find(|x| x.0 == attr) {
None => &AttributeValue::Null(true),
Some(x) => x.1
};
line.push(',');
// NOTE: If special handling for complex data type is needed: `if let Some(_) = attrval.m {...`
line.push_str(&attrval_to_jsonval(attrval).to_string());
Expand Down

0 comments on commit 9ae3715

Please sign in to comment.