Skip to content

Commit

Permalink
Sort of handle boolean nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrw committed Jul 26, 2024
1 parent b2ba5c2 commit bcf50f7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fitsio/src/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ impl ReadsCol for bool {
}

match status {
0 => Ok(out.into_iter().map(|v| v > 0).collect()),
// TODO: this does not correctly account for nyll values,
// instead treat them as falsy for now
0 => Ok(out.into_iter().map(|v| v != BOOL_NULL && v > 0).collect()),
307 => Err(IndexError {
message: "given indices out of range".to_string(),
given: range.clone(),
Expand Down Expand Up @@ -236,8 +238,9 @@ impl ReadsCol for bool {
&mut status,
);
}

check_status(status).map(|_| out > 0)
// TODO: this does not correctly account for nyll values,
// instead treat them as falsy for now
check_status(status).map(|_| out != BOOL_NULL && out > 0)
}
Err(e) => Err(e),
_ => panic!("Unknown error occurred"),
Expand Down

0 comments on commit bcf50f7

Please sign in to comment.