mirror of
https://github.com/aljazceru/pkdns.git
synced 2025-12-17 05:54:21 +01:00
fix: prevent panic if query has no question
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1008,7 +1008,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pkdns"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"any-dns",
|
||||
"clap",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "pkdns"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@@ -46,7 +46,11 @@ impl PknamesResolver {
|
||||
return pkarr_result; // It was a pkarr hostname
|
||||
}
|
||||
|
||||
let question = original_query.questions.first().unwrap();
|
||||
let question = original_query.questions.first();
|
||||
if let None = question {
|
||||
|
||||
}
|
||||
let question = original_query.questions.first().ok_or("Query does not include a question.")?;
|
||||
let domain = question.qname.to_string();
|
||||
let pkarr_domain = self.predict_pknames_domain(&domain)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user