Minecoprocessors

Minecoprocessors

183k Downloads

Potential null pointer access

josephcsible opened this issue ยท 0 comments

commented

byte[] registers = processor == null ? null : processor.getRegisters();
byte value = registers == null ? 0 : registers[register.ordinal()];
boolean mouseIsOver = centered(toHex(value), x, y, mouseX, mouseY);
if (mouseIsOver) {
int portIndex = register.ordinal() - Register.PF.ordinal();
byte ports = registers[Register.PORTS.ordinal()];

It looks like you expect registers to sometimes be null, but you try to access it without checking it. This will cause a crash if it ever does happen to be null.