Skip to content

Commit

Permalink
handle case when metrics is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
pythops committed Jan 12, 2025
1 parent 9d8616c commit 82f1c6a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions oryx-tui/src/section/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ impl Metrics {
pub fn handle_keys(&mut self, key_event: KeyEvent) {
match key_event.code {
KeyCode::Char('d') => {
if self.metrics.is_empty() {
return;
}
if let Some(selected_item_index) = &mut self.state.selected {
self.terminate
.store(true, std::sync::atomic::Ordering::Relaxed);
Expand Down Expand Up @@ -234,6 +237,9 @@ impl Metrics {
}

KeyCode::Char('j') | KeyCode::Down => {
if self.metrics.is_empty() {
return;
}
let i = match self.state.selected {
Some(i) => {
if i < self.window_height - 1 {
Expand Down

0 comments on commit 82f1c6a

Please sign in to comment.