mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
wasm: more meaningful error when NameSection is missing
This commit is contained in:
parent
90cd644671
commit
2f654ca6dd
1 changed files with 4 additions and 0 deletions
|
@ -1155,6 +1155,10 @@ impl<'a> NameSection<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse(arena: &'a Bump, module_bytes: &[u8], cursor: &mut usize) -> Self {
|
pub fn parse(arena: &'a Bump, module_bytes: &[u8], cursor: &mut usize) -> Self {
|
||||||
|
if *cursor >= module_bytes.len() {
|
||||||
|
internal_error!("NameSection not found in preloaded object file");
|
||||||
|
}
|
||||||
|
|
||||||
// Custom section ID
|
// Custom section ID
|
||||||
let section_id_byte = module_bytes[*cursor];
|
let section_id_byte = module_bytes[*cursor];
|
||||||
if section_id_byte != Self::ID as u8 {
|
if section_id_byte != Self::ID as u8 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue