no panic on missing port

This commit is contained in:
jb-alvarado 2024-09-23 08:15:19 +02:00
parent 66b51fa529
commit 45a69ac003
2 changed files with 7 additions and 2 deletions

View File

@ -94,7 +94,12 @@ async fn main() -> std::io::Result<()> {
let ip_port = conn.split(':').collect::<Vec<&str>>();
let addr = ip_port[0];
let port = ip_port[1].parse::<u16>().unwrap();
let port = ip_port
.get(1)
.ok_or("<ADRESSE>:<PORT> needed!")
.map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))?
.parse::<u16>()
.unwrap();
let controllers = web::Data::from(channel_controllers.clone());
let auth_state = web::Data::new(SseAuthState {
uuids: tokio::sync::Mutex::new(HashSet::new()),

View File

@ -154,7 +154,7 @@ impl Iterator for FolderSource {
self.sort();
}
self.current_node = match self.manager.current_list.lock().unwrap().get(0) {
self.current_node = match self.manager.current_list.lock().unwrap().first() {
Some(m) => m.clone(),
None => return None,
};