fix(bug): replace unwrap() with unwrap_or_default() to propagate errors for better handling

This commit is contained in:
2025-04-22 17:36:50 +08:00
committed by Samuel Dai
parent 2f83a94476
commit 9277d3ef0b
2 changed files with 3 additions and 3 deletions

View File

@ -492,8 +492,8 @@ impl ContainerdManager {
pub fn get_address(cid: &str) -> String {
let map = GLOBAL_NETNS_MAP.read().unwrap();
let config = map.get(cid).unwrap();
config.get_address()
let addr = map.get(cid).map(|net_conf| net_conf.get_address());
addr.unwrap_or_default()
}
fn remove_container_network_config(cid: &str) {