check if token file exists
prevents crash if token file is missing note: this is a quick fix; returned token should be Option<String> instead of String
This commit is contained in:
parent
faa09e64f6
commit
d28913b141
@ -29,6 +29,10 @@ struct Saved {
|
|||||||
|
|
||||||
fn get_token() -> String {
|
fn get_token() -> String {
|
||||||
let mut token: String = String::new();
|
let mut token: String = String::new();
|
||||||
|
//check if file exists
|
||||||
|
if !std::path::Path::new(&(get_ipass_folder()+"token.ipasst")).exists() {
|
||||||
|
return "".to_string();
|
||||||
|
}
|
||||||
File::open(get_ipass_folder()+"token.ipasst").unwrap().read_to_string(&mut token).unwrap();
|
File::open(get_ipass_folder()+"token.ipasst").unwrap().read_to_string(&mut token).unwrap();
|
||||||
token
|
token
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user