Merge pull request 'Fix NotNullTerminated error for full-length strings' (#1) from nsabaj/vmdl:main into main

Reviewed-on: https://codeberg.org/icewind/vmdl/pulls/1
This commit is contained in:
Robin Appelman 2026-01-06 23:35:58 +01:00
commit 20cd63351f

View file

@ -270,7 +270,7 @@ impl<const LEN: usize> TryFrom<[u8; LEN]> for FixedString<LEN> {
let zero_pos = name_buf
.iter()
.position(|c| *c == 0)
.ok_or(StringError::NotNullTerminated)?;
.unwrap_or(name_buf.len());
let name = &name_buf[..zero_pos];
Ok(FixedString(
ArrayString::from(str::from_utf8(name).map_err(StringError::NonUTF8)?).unwrap(),