1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-09 18:29:36 +00:00

- Fixed an issue where __zp without specifying the number would cause a crash.

This commit is contained in:
Sven Van de Velde 2023-12-17 11:39:53 +01:00
parent d75d96473c
commit dcbf2a4efe
2 changed files with 3 additions and 3 deletions

View File

@ -471,7 +471,7 @@ public class VariableBuilder {
}
Directive.MemZp zpDirective = findDirective(Directive.MemZp.class, directives);
if(zpDirective != null) {
if(zpDirective != null && zpDirective.zp != null) {
return new Registers.RegisterZpMem(zpDirective.zp, -1, true);
}

View File

@ -1532,9 +1532,9 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
@Override
public Directive visitDirectiveMemoryAreaZp(KickCParser.DirectiveMemoryAreaZpContext ctx) {
String zpText = ctx.NUMBER().getText();
if(zpText != null)
if(ctx.NUMBER() != null)
try {
String zpText = ctx.NUMBER().getText();
Number zpNumber = NumberParser.parseLiteral(zpText);
return new Directive.MemZp(zpNumber.intValue());
} catch(NumberFormatException e) {