Skip to content

Commit

Permalink
fix(cognitarium): return empty iter on not found triple iter load
Browse files Browse the repository at this point in the history
  • Loading branch information
amimart committed Jun 5, 2023
1 parent 4d42bf3 commit 757177d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions contracts/okp4-cognitarium/src/querier/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,13 @@ impl<'a> TriplePatternIterator<'a> {
filters: TriplePatternFilters,
) -> Box<dyn Iterator<Item = StdResult<Triple>> + 'a> {
match filters {
(Some(s), Some(p), Some(o)) => Box::new(iter::once(
triples().load(storage, (o.as_hash().as_bytes(), p.key(), s.key())),
)),
(Some(s), Some(p), Some(o)) => {
let res = triples().load(storage, (o.as_hash().as_bytes(), p.key(), s.key()));
match res {
Err(StdError::NotFound { .. }) => Box::new(iter::empty()),
_ => Box::new(iter::once(res)),
}
}
(Some(s), Some(p), None) => Box::new(
triples()
.idx
Expand Down

0 comments on commit 757177d

Please sign in to comment.