forked from mirrors/rustdesk
Fix: replace unwrap() with proper error handling in CLI password prompt (#14910)
Signed-off-by: bunnysayzz <stfuazzo@gmail.com>
This commit is contained in:
parent
3a1622e8b5
commit
5ea6714db8
1 changed files with 7 additions and 1 deletions
|
|
@ -25,7 +25,13 @@ impl Session {
|
|||
pub fn new(id: &str, sender: mpsc::UnboundedSender<Data>) -> 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(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue