diff --git a/Cargo.lock b/Cargo.lock index 6de355a..1970b20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1075,7 +1075,7 @@ dependencies = [ [[package]] name = "pkdns" -version = "0.2.1" +version = "0.2.2" dependencies = [ "any-dns", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 500edc8..758301b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pkdns" -version = "0.2.1" +version = "0.2.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/pkarr_resolver.rs b/src/pkarr_resolver.rs index 1e7b47b..13f585d 100644 --- a/src/pkarr_resolver.rs +++ b/src/pkarr_resolver.rs @@ -83,6 +83,9 @@ impl PkarrResolver { } let question = question_opt.unwrap(); let labels = question.qname.get_labels(); + if labels.len() == 0 { + return Err("No label in question.qname.".into()); + }; let raw_pubkey = labels.last().unwrap().to_string(); let parsed_option = Self::parse_pkarr_uri(&raw_pubkey);