diff --git a/crates/re_data_store/src/entity_tree.rs b/crates/re_data_store/src/entity_tree.rs index 20ef41769734..451bd8f5325f 100644 --- a/crates/re_data_store/src/entity_tree.rs +++ b/crates/re_data_store/src/entity_tree.rs @@ -40,7 +40,6 @@ impl TimeHistogramPerTimeline { // ---------------------------------------------------------------------------- /// Number of messages per time per timeline -#[derive(Default)] pub struct TimesPerTimeline(BTreeMap>); impl TimesPerTimeline { @@ -79,6 +78,13 @@ impl TimesPerTimeline { } } +// Always ensure we have a default "log_time" timeline. +impl Default for TimesPerTimeline { + fn default() -> Self { + Self(BTreeMap::from([(Timeline::log_time(), Default::default())])) + } +} + // ---------------------------------------------------------------------------- /// Tree of entity paths, plus components at the leaves. diff --git a/crates/re_viewer/src/misc/time_control.rs b/crates/re_viewer/src/misc/time_control.rs index 8b8eeb7da001..836f2a7bfd3a 100644 --- a/crates/re_viewer/src/misc/time_control.rs +++ b/crates/re_viewer/src/misc/time_control.rs @@ -501,11 +501,11 @@ impl TimeControl { } fn min(values: &BTreeSet) -> TimeInt { - *values.iter().next().unwrap() + *values.iter().next().unwrap_or(&TimeInt::BEGINNING) } fn max(values: &BTreeSet) -> TimeInt { - *values.iter().rev().next().unwrap() + *values.iter().rev().next().unwrap_or(&TimeInt::BEGINNING) } fn range(values: &BTreeSet) -> TimeRange {