From 5ea6714db8c47e4eb660c22cd55208ce3dce828d Mon Sep 17 00:00:00 2001 From: Azhar Date: Sun, 26 Apr 2026 18:58:05 +0530 Subject: [PATCH] Fix: replace unwrap() with proper error handling in CLI password prompt (#14910) Signed-off-by: bunnysayzz --- src/cli.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cli.rs b/src/cli.rs index f61bfe92f..2f3b3550f 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -25,7 +25,13 @@ impl Session { pub fn new(id: &str, sender: mpsc::UnboundedSender) -> Self { let mut password = "".to_owned(); if PeerConfig::load(id).password.is_empty() { - password = rpassword::prompt_password("Enter password: ").unwrap(); + match rpassword::prompt_password("Enter password: ") { + Ok(p) => password = p, + Err(e) => { + log::error!("Failed to read password: {:?}", e); + password = "".to_owned(); + } + } } let session = Self { id: id.to_owned(),