mirror of
https://codeberg.org/icewind/vmdl.git
synced 2026-06-03 16:44:11 +02:00
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:
commit
20cd63351f
1 changed files with 1 additions and 1 deletions
|
|
@ -270,7 +270,7 @@ impl<const LEN: usize> TryFrom<[u8; LEN]> for FixedString<LEN> {
|
||||||
let zero_pos = name_buf
|
let zero_pos = name_buf
|
||||||
.iter()
|
.iter()
|
||||||
.position(|c| *c == 0)
|
.position(|c| *c == 0)
|
||||||
.ok_or(StringError::NotNullTerminated)?;
|
.unwrap_or(name_buf.len());
|
||||||
let name = &name_buf[..zero_pos];
|
let name = &name_buf[..zero_pos];
|
||||||
Ok(FixedString(
|
Ok(FixedString(
|
||||||
ArrayString::from(str::from_utf8(name).map_err(StringError::NonUTF8)?).unwrap(),
|
ArrayString::from(str::from_utf8(name).map_err(StringError::NonUTF8)?).unwrap(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue