Skip to content

Commit

Permalink
Fix FixedString::from_static_trunc panic
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Feb 6, 2024
1 parent fae92d2 commit 9750639
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl<LenT: ValidLength> FixedString<LenT> {
/// See [`Self::from_string_trunc`] for truncation behaviour.
pub fn from_static_trunc(val: &'static str) -> Self {
Self(FixedStringRepr::Static(StaticStr::from_static_str(
&val[..LenT::MAX.to_usize()],
&val[..val.len().max(LenT::MAX.to_usize())],
)))
}

Expand Down

0 comments on commit 9750639

Please sign in to comment.