]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Prevent crash if Gayle IDE was not initialized for some unexpected reason.
authorToni Wilen <twilen@winuae.net>
Sun, 15 Aug 2021 06:58:28 +0000 (09:58 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 15 Aug 2021 06:58:28 +0000 (09:58 +0300)
gayle.cpp

index c8517c4f08c511e7b409f310d3f8e3345ce2d760..6e24e5518393e62119abdeaf8f5c9f4de05422c2 100644 (file)
--- 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;