better error messages for parsing rom title

This commit is contained in:
Alex Janka 2023-03-25 17:23:48 +11:00
parent 538d8d75cc
commit adaf203e73

View file

@ -9,7 +9,7 @@ use std::{
io::{Read, Seek, SeekFrom, Write},
marker::PhantomData,
path::PathBuf,
str::from_utf8_unchecked,
str::from_utf8,
};
use self::mbcs::{
@ -194,7 +194,9 @@ where
break;
}
}
let title = unsafe { from_utf8_unchecked(&data[0x134..title_length]).to_string() };
let title = from_utf8(&data[0x134..title_length])
.expect("Error parsing title")
.to_string();
let _gbc_flag = data[0x143];