mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Avoid performing invalid actions on LOAD errors
These are rejected because they could lead to incorrect behavior, so then don't do it...
This commit is contained in:
@@ -417,11 +417,15 @@ void out_SetLoadSection(char const *name, uint32_t type, uint32_t org,
|
||||
if (!checkcodesection())
|
||||
return;
|
||||
|
||||
if (currentLoadSection)
|
||||
fatalerror("`LOAD` blocks cannot be nested\n");
|
||||
if (currentLoadSection) {
|
||||
error("`LOAD` blocks cannot be nested\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sect_HasData(type))
|
||||
if (sect_HasData(type)) {
|
||||
error("`LOAD` blocks cannot create a ROM section\n");
|
||||
return;
|
||||
}
|
||||
|
||||
struct Section *sect = getSection(name, type, org, attribs, mod);
|
||||
|
||||
@@ -433,8 +437,10 @@ void out_SetLoadSection(char const *name, uint32_t type, uint32_t org,
|
||||
|
||||
void out_EndLoadSection(void)
|
||||
{
|
||||
if (!currentLoadSection)
|
||||
if (!currentLoadSection) {
|
||||
error("Found `ENDL` outside of a `LOAD` block\n");
|
||||
return;
|
||||
}
|
||||
|
||||
changeSection();
|
||||
curOffset += loadOffset;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
ERROR: load-rom.asm(3):
|
||||
`LOAD` blocks cannot create a ROM section
|
||||
error: Assembly aborted (1 error)!
|
||||
ERROR: load-rom.asm(5):
|
||||
Found `ENDL` outside of a `LOAD` block
|
||||
error: Assembly aborted (2 errors)!
|
||||
|
||||
Reference in New Issue
Block a user