mirror of
https://github.com/JorjBauer/aiie.git
synced 2024-11-29 16:49:26 +00:00
fix crasher when accessing empty drive
This commit is contained in:
parent
48ef6a4dea
commit
36ce493c1e
@ -461,7 +461,11 @@ void DiskII::setPhase(uint8_t phase)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (curHalfTrack[selectedDisk] != prevHalfTrack) {
|
if (curHalfTrack[selectedDisk] != prevHalfTrack) {
|
||||||
|
if (disk[selectedDisk]) {
|
||||||
curWozTrack[selectedDisk] = disk[selectedDisk]->dataTrackNumberForQuarterTrack(curHalfTrack[selectedDisk]*2);
|
curWozTrack[selectedDisk] = disk[selectedDisk]->dataTrackNumberForQuarterTrack(curHalfTrack[selectedDisk]*2);
|
||||||
|
} else {
|
||||||
|
curWozTrack[selectedDisk] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,7 +551,11 @@ void DiskII::insertDisk(int8_t driveNum, const char *filename, bool drawIt)
|
|||||||
|
|
||||||
disk[driveNum] = new WozSerializer();
|
disk[driveNum] = new WozSerializer();
|
||||||
// intentionally 'false' (see above call to readFile)
|
// intentionally 'false' (see above call to readFile)
|
||||||
disk[driveNum]->readFile(filename, false, T_AUTO); // FIXME error checking
|
if (!disk[driveNum]->readFile(filename, false, T_AUTO)) {
|
||||||
|
delete disk[driveNum];
|
||||||
|
disk[driveNum] = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
curWozTrack[driveNum] = disk[driveNum]->dataTrackNumberForQuarterTrack(curHalfTrack[driveNum]*2);
|
curWozTrack[driveNum] = disk[driveNum]->dataTrackNumberForQuarterTrack(curHalfTrack[driveNum]*2);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user