mirror of
https://github.com/nushell/nushell.git
synced 2025-05-01 00:24:29 +02:00
Fix menu panic for empty examples. (#5581)
This commit is contained in:
parent
2b1e05aad0
commit
ac30b3d108
@ -586,7 +586,7 @@ impl Menu for DescriptionMenu {
|
|||||||
} else {
|
} else {
|
||||||
self.example_index = Some(self.examples.len().saturating_sub(1));
|
self.example_index = Some(self.examples.len().saturating_sub(1));
|
||||||
}
|
}
|
||||||
} else {
|
} else if !self.examples.is_empty() {
|
||||||
self.example_index = Some(0);
|
self.example_index = Some(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -598,7 +598,7 @@ impl Menu for DescriptionMenu {
|
|||||||
} else {
|
} else {
|
||||||
self.example_index = Some(0);
|
self.example_index = Some(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else if !self.examples.is_empty() {
|
||||||
self.example_index = Some(0);
|
self.example_index = Some(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user