From: Toni Wilen Date: Sun, 15 Aug 2021 06:58:28 +0000 (+0300) Subject: Prevent crash if Gayle IDE was not initialized for some unexpected reason. X-Git-Tag: 4900~89 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=22c192bfe7a31b92c7a6e9443e980db4a6be8e0c;p=francis%2Fwinuae.git Prevent crash if Gayle IDE was not initialized for some unexpected reason. --- diff --git a/gayle.cpp b/gayle.cpp index c8517c4f..6e24e551 100644 --- a/gayle.cpp +++ b/gayle.cpp @@ -395,11 +395,16 @@ static int get_gayle_ide_reg (uaecptr addr, struct ide_hdf **ide) addr &= ~IDE_SECONDARY; } } + if (idedrive[ide2] == NULL) { + return -1; + } *ide = idedrive[ide2 + idedrive[ide2]->ide_drv]; + if (*ide == NULL) { + return -1; + } return addr; } - static uae_u32 gayle_read2 (uaecptr addr) { struct ide_hdf *ide = NULL;