From 37c77cf0cf8539fc34c408b1a2c016a381c91abe Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 13 Feb 2022 23:50:27 +0100 Subject: [PATCH] Added some sanity checks to IDE. --- src/disk/hdc_ide.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index a1409175f..6db383cf0 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -3018,8 +3018,11 @@ ide_reset(void *p) { ide_log("Resetting IDE...\n"); - ide_board_reset(0); - ide_board_reset(1); + if (ide_boards[0] != NULL) + ide_board_reset(0); + + if (ide_boards[1] != NULL) + ide_board_reset(1); } @@ -3029,8 +3032,15 @@ ide_close(void *priv) { ide_log("Closing IDE...\n"); - ide_board_close(0); - ide_board_close(1); + if (ide_boards[0] != NULL) { + ide_board_close(0); + ide_boards[0] = NULL; + } + + if (ide_boards[1] != NULL) { + ide_board_close(1); + ide_boards[1] = NULL; + } }