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() {