1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-22 14:30:45 +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; break;
case 0x9: case 0x9:
if (mach->selected_drive) {
apple2_dd_turn_on(mach->selected_drive, true); apple2_dd_turn_on(mach->selected_drive, true);
}
break; break;
case 0xA: case 0xA:
@ -431,11 +433,15 @@ apple2_dd_switch_drive(apple2 *mach, size_t addr)
break; break;
case 0xE: case 0xE:
if (mach->selected_drive) {
mach->selected_drive->mode = DD_READ; mach->selected_drive->mode = DD_READ;
}
break; break;
case 0xF: case 0xF:
if (mach->selected_drive) {
mach->selected_drive->mode = DD_WRITE; mach->selected_drive->mode = DD_WRITE;
}
break; break;
} }
} }