Browse Source

darkirc: fix contacts/secret key parse bug

dasman 2 years ago
parent
commit
f8bcb639a8
1 changed files with 3 additions and 0 deletions
  1. 3 0
      bin/darkirc/src/settings.rs

+ 3 - 0
bin/darkirc/src/settings.rs

@@ -142,6 +142,9 @@ pub fn parse_configured_contacts(data: &toml::Value) -> Result<HashMap<String, I
     let mut ret = HashMap::new();
     let mut ret = HashMap::new();
 
 
     let contacts = list_configured_contacts(data)?;
     let contacts = list_configured_contacts(data)?;
+    if contacts.is_empty() {
+        return Ok(ret);
+    }
     let Some(secret) = parse_dm_chacha_secret(data)? else {
     let Some(secret) = parse_dm_chacha_secret(data)? else {
         return Err(ParseFailed("You have specified some contacts but you did not set up a valid chacha secret for yourself.  You can generate a keypair with: 'darkirc --gen-chacha-keypair' and then add that keypair to your config toml file."))
         return Err(ParseFailed("You have specified some contacts but you did not set up a valid chacha secret for yourself.  You can generate a keypair with: 'darkirc --gen-chacha-keypair' and then add that keypair to your config toml file."))
     };
     };