diff --git a/hw/fdc.c b/hw/fdc.c index a47b809b44cd5ebf2c8cad8db853b6ac12cfda78..ec4fa722751e4b598e6777dba929322a1e5b1aa0 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -788,8 +788,12 @@ static int fdctrl_transfer_handler (uint32_t addr, int size, int *irq) } if (fdctrl.data_dir != FD_DIR_WRITE) { /* READ & SCAN commands */ - if (cur_drv->bs == NULL || - bdrv_read(cur_drv->bs, fd_sector(cur_drv), orig, 1) < 0) { + if (cur_drv->bs == NULL) { + fdctrl_stop_transfer(0x40, 0x00, 0x00); + goto transfer_error; + } + + if (bdrv_read(cur_drv->bs, fd_sector(cur_drv), orig, 1) < 0) { FLOPPY_DPRINTF("Floppy: error getting sector %d\n", fd_sector(cur_drv)); /* Sure, image size is too small... */