Skip to content

Commit

Permalink
Merge pull request #81 from aya-lang/bugfix/graphics-npe
Browse files Browse the repository at this point in the history
Bugfix/graphics npe
  • Loading branch information
nick-paul authored May 12, 2023
2 parents 66c4e8f + f9379fc commit ef24f3b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/aya/ext/graphics/instruction/cursor/MoveEventsInstruction.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package aya.ext.graphics.instruction.cursor;

import aya.exceptions.runtime.ValueError;
import aya.ext.graphics.Canvas;
import aya.ext.graphics.CanvasCursorListener;
import aya.ext.graphics.CanvasTable;
Expand All @@ -16,10 +17,14 @@ public MoveEventsInstruction(CanvasTable canvas_table) {

@Override
protected void doCanvasCommand(Canvas cvs, Block block) {
block.push(
cvs.getCursorListener().getMoveHistory().stream()
.map(CanvasCursorListener.MoveInfo::toDict)
.collect(new ListCollector())
);
try {
block.push(
cvs.getCursorListener().getMoveHistory().stream()
.map(CanvasCursorListener.MoveInfo::toDict)
.collect(new ListCollector())
);
} catch (NullPointerException e) {
throw new ValueError(e.getMessage());
}
}
}
8 changes: 8 additions & 0 deletions std/canvas.aya
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,12 @@ def canvas::pressed_buttons {self,

def canvas::typed_chars {self,
self.id :{graphics.typed_chars}
}

def canvas::pressed_keys {self,
self.id :{graphics.pressed_keys}
}

def canvas::text {self,
self.id :{graphics.text}
}

0 comments on commit ef24f3b

Please sign in to comment.