Make sure CPU exists on computer object before trying to use it

This commit is contained in:
Brendan Robert 2015-03-30 00:29:47 -05:00
parent 430ab4e4de
commit 3bca1f29c0

View File

@ -129,6 +129,7 @@ public class CardMassStorage extends Card implements MediaConsumerParent {
@Override @Override
public void reconfigure() { public void reconfigure() {
unregisterListeners(); unregisterListeners();
if (computer.getCpu() != null) {
int pc = computer.getCpu().getProgramCounter(); int pc = computer.getCpu().getProgramCounter();
if (drive1.getCurrentDisk() != null && getSlot() == 7 && (pc >= 0x0c65e && pc <= 0x0c66F)) { if (drive1.getCurrentDisk() != null && getSlot() == 7 && (pc >= 0x0c65e && pc <= 0x0c66F)) {
// If the computer is in a loop trying to boot from cards 6, fast-boot from here instead // If the computer is in a loop trying to boot from cards 6, fast-boot from here instead
@ -136,6 +137,7 @@ public class CardMassStorage extends Card implements MediaConsumerParent {
currentDrive = drive1; currentDrive = drive1;
EmulatorUILogic.simulateCtrlAppleReset(); EmulatorUILogic.simulateCtrlAppleReset();
} }
}
registerListeners(); registerListeners();
} }