diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index 6ffa47f29..1f49b192a 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -79,6 +79,8 @@ int floppyrate[4]; int fdc_current[FDC_MAX] = { 0, 0 }; +volatile int fdcinited = 0; + #ifdef ENABLE_FDC_LOG int fdc_do_log = ENABLE_FDC_LOG; @@ -2348,6 +2350,8 @@ fdc_close(void *priv) fifo_close(fdc->fifo_p); + fdcinited = 0; + free(fdc); } @@ -2393,6 +2397,8 @@ fdc_init(const device_t *info) fdc_reset(fdc); + fdcinited = 1; + return fdc; } diff --git a/src/qt/qt_machinestatus.cpp b/src/qt/qt_machinestatus.cpp index d555be360..aba7fc1d4 100644 --- a/src/qt/qt_machinestatus.cpp +++ b/src/qt/qt_machinestatus.cpp @@ -40,6 +40,8 @@ extern "C" { #include <86box/ui.h> #include <86box/machine_status.h> #include <86box/config.h> + +extern volatile int fdcinited; }; #include @@ -303,6 +305,9 @@ MachineStatus::hasSCSI() void MachineStatus::iterateFDD(const std::function &cb) { + if (!fdcinited) + return; + for (int i = 0; i < FDD_NUM; ++i) { if (fdd_get_type(i) != 0) { cb(i);