From 3322ca4756de1ea2de4d6971819c3f60990454db Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Mon, 9 Sep 2024 00:37:02 +0200 Subject: [PATCH] hrp: small improvement in hrp parsing --- src/primitives/hrp.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/primitives/hrp.rs b/src/primitives/hrp.rs index 176606c97..5153bc20d 100644 --- a/src/primitives/hrp.rs +++ b/src/primitives/hrp.rs @@ -78,8 +78,6 @@ impl Hrp { pub fn parse(hrp: &str) -> Result { use Error::*; - let mut new = Hrp { buf: [0_u8; MAX_HRP_LEN], size: 0 }; - if hrp.is_empty() { return Err(Empty); } @@ -87,6 +85,8 @@ impl Hrp { return Err(TooLong(hrp.len())); } + let mut new = Hrp { buf: [0_u8; MAX_HRP_LEN], size: 0 }; + let mut has_lower: bool = false; let mut has_upper: bool = false; for (i, c) in hrp.chars().enumerate() {