Fix BANK(@) outside sections causing crashes

This commit is contained in:
ISSOtm
2020-04-07 15:45:30 +02:00
parent 562835308b
commit 9f82fa4cf7
5 changed files with 14 additions and 2 deletions

View File

@@ -143,7 +143,10 @@ void rpn_BankSelf(struct Expression *expr)
{
rpn_Init(expr);
if (pCurrentSection->nBank == -1) {
if (!pCurrentSection) {
yyerror("PC has no bank outside a section");
expr->nVal = 1;
} else if (pCurrentSection->nBank == -1) {
makeUnknown(expr, "Current section's bank is not known");
expr->nRPNPatchSize++;
*reserveSpace(expr, 1) = RPN_BANK_SELF;