fix: docker data remove unwrap()
use filter_map in update_containers iter, rather than map(i.unwrap())
This commit is contained in:
+4
-4
@@ -99,9 +99,9 @@ impl AppData {
|
|||||||
self.error = Some(error);
|
self.error = Some(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find the if of the currently selected container
|
/// Find the if of the currently selected container.
|
||||||
/// If any containers on system, will always return
|
/// If any containers on system, will always return a string.
|
||||||
/// Only returns None when no containers found
|
/// Only returns None when no containers found.
|
||||||
pub fn get_selected_container_id(&self) -> Option<String> {
|
pub fn get_selected_container_id(&self) -> Option<String> {
|
||||||
let mut output = None;
|
let mut output = None;
|
||||||
if let Some(index) = self.containers.state.selected() {
|
if let Some(index) = self.containers.state.selected() {
|
||||||
@@ -296,7 +296,7 @@ impl AppData {
|
|||||||
for (index, id) in all_ids.iter().enumerate() {
|
for (index, id) in all_ids.iter().enumerate() {
|
||||||
if !containers
|
if !containers
|
||||||
.iter()
|
.iter()
|
||||||
.map(|i| i.id.as_ref().unwrap())
|
.filter_map(|i| i.id.as_ref())
|
||||||
.any(|x| x == id)
|
.any(|x| x == id)
|
||||||
{
|
{
|
||||||
// If removed container is currently selected, then change selected to previous
|
// If removed container is currently selected, then change selected to previous
|
||||||
|
|||||||
Reference in New Issue
Block a user