Don't resize DiskCache without a file

DiskCache computes its size from a file.
Skip ResizeCache Without file (i.e. 'empty' CD)

Fixes #1426

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
This commit is contained in:
Klaus Kämpf 2024-02-26 18:59:23 +01:00
parent b074f7dc9b
commit 0674d6eaf1
1 changed files with 5 additions and 1 deletions

View File

@ -179,7 +179,11 @@ void SCSICD::ModeSelect(scsi_command cmd, cdb_t cdb, span<const uint8_t> buf, in
ClearTrack();
CreateDataTrack();
FlushCache();
ResizeCache(GetFilename(), GetRawMode());
string filename;
if ((filename = GetFilename()) != "") {
// DiskCache fails without a file to compute the cache size
ResizeCache(filename, GetRawMode());
}
}
if (const string result = scsi_command_util::ModeSelect(cmd, cdb, buf, length, sector_size);