From f8b8963776eb17e0bff80193e049e2b6005e33d9 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 16 May 2025 17:54:02 +1000 Subject: [PATCH] CDImageDevice: Fix possible invalid optional access --- src/util/cd_image_device.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/cd_image_device.cpp b/src/util/cd_image_device.cpp index 70e25be1e..80f088cc4 100644 --- a/src/util/cd_image_device.cpp +++ b/src/util/cd_image_device.cpp @@ -544,7 +544,7 @@ bool CDImageDeviceWin32::ReadSectorToBuffer(LBA lba) const u32 expected_size = SCSIReadCommandOutputSize(m_scsi_read_mode); if (size.value_or(0) != expected_size) { - ERROR_LOG("Read of LBA {} failed: only got {} of {} bytes", lba, size.value(), expected_size); + ERROR_LOG("Read of LBA {} failed: only got {} of {} bytes", lba, size.value_or(0), expected_size); return false; } } @@ -1015,7 +1015,7 @@ bool CDImageDeviceLinux::ReadSectorToBuffer(LBA lba) const u32 expected_size = SCSIReadCommandOutputSize(m_scsi_read_mode); if (size.value_or(0) != expected_size) { - ERROR_LOG("Read of LBA {} failed: only got {} of {} bytes", lba, size.value(), expected_size); + ERROR_LOG("Read of LBA {} failed: only got {} of {} bytes", lba, size.value_or(0), expected_size); return false; } }