1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-11-27 20:51:17 +00:00

Add better handling if selected_drive is NULL

(Discovered from static analysis)
This commit is contained in:
Peter Evans 2018-02-06 14:58:00 -06:00
parent 0dce7dbc58
commit fa5bfe09ae

View File

@ -419,7 +419,9 @@ apple2_dd_switch_drive(apple2 *mach, size_t addr)
break;
case 0x9:
if (mach->selected_drive) {
apple2_dd_turn_on(mach->selected_drive, true);
}
break;
case 0xA:
@ -431,11 +433,15 @@ apple2_dd_switch_drive(apple2 *mach, size_t addr)
break;
case 0xE:
if (mach->selected_drive) {
mach->selected_drive->mode = DD_READ;
}
break;
case 0xF:
if (mach->selected_drive) {
mach->selected_drive->mode = DD_WRITE;
}
break;
}
}