From e13b389995b5f1faff2ad8ec4bb8e8362e22e18a Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Tue, 27 Aug 2024 18:18:56 +0200 Subject: [PATCH] Fix `Chunk::component_batch_raw` not checking the bitmap first (#7286) @abey79 discovered the issue when doing the Chunk Store UI. Before: ![image](https://github.com/user-attachments/assets/3d117e0f-426a-4889-91da-81a8424aa4c7) After: ![image](https://github.com/user-attachments/assets/aba46949-2fbc-442f-a5bd-0a7f3e9b11b4) --- crates/store/re_chunk/src/helpers.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/store/re_chunk/src/helpers.rs b/crates/store/re_chunk/src/helpers.rs index 26397291cfc8..f02b4b299d5c 100644 --- a/crates/store/re_chunk/src/helpers.rs +++ b/crates/store/re_chunk/src/helpers.rs @@ -21,15 +21,17 @@ impl Chunk { component_name: &ComponentName, row_index: usize, ) -> Option>> { - self.components.get(component_name).map(|list_array| { + self.components.get(component_name).and_then(|list_array| { if list_array.len() > row_index { - Ok(list_array.value(row_index)) + list_array + .is_valid(row_index) + .then(|| Ok(list_array.value(row_index))) } else { - Err(crate::ChunkError::IndexOutOfBounds { + Some(Err(crate::ChunkError::IndexOutOfBounds { kind: "row".to_owned(), len: list_array.len(), index: row_index, - }) + })) } }) } @@ -258,7 +260,7 @@ impl UnitChunkShared { debug_assert!(self.num_rows() == 1); self.components .get(component_name) - .map(|list_array| list_array.value(0)) + .and_then(|list_array| list_array.is_valid(0).then(|| list_array.value(0))) } /// Returns the deserialized data for the specified component.