Skip to content

Commit a91b9e2

Browse files
berkgevecijourdain
authored andcommitted
fix: prevent animation toolbar crash when no data is loaded
Default animation_track to None instead of "timestamps" to avoid crashing at startup before any file is loaded. Also guard against empty state values in the track change handler.
1 parent 79c0c03 commit a91b9e2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/e3sm_quickview/components/toolbars.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def __init__(self):
438438
)
439439
with v3.VRow(classes="ma-0 px-2 align-center"):
440440
v3.VSelect(
441-
v_model=("animation_track", "timestamps"),
441+
v_model=("animation_track", None),
442442
items=("available_animation_tracks", []),
443443
flat=True,
444444
variant="plain",
@@ -494,7 +494,9 @@ def _on_animation_track_change(self, animation_track, **_):
494494
self.state.amimation_step_max = 0
495495

496496
if animation_track:
497-
self.state.amimation_step_max = len(self.state[animation_track]) - 1
497+
values = self.state[animation_track]
498+
if values:
499+
self.state.amimation_step_max = len(values) - 1
498500

499501
@change("animation_step")
500502
def _on_animation_step(self, animation_track, animation_step, **_):

0 commit comments

Comments
 (0)