mirror of
https://codeberg.org/icewind/vmdl.git
synced 2026-06-03 16:44:11 +02:00
Fix NotNullTerminated error for full-length strings
When a fixed-length string field uses its entire buffer without a null terminator, treat the full buffer as valid content instead of erroring. This handles edge cases in some MDL files where string fields are completely filled. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ba17203e59
commit
115e233517
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