Skip to content

Commit f96b268

Browse files
authored
Merge pull request #413 from BlueSCSI/eric/fix-playaudio-null-parser
audio: don't crash on zero-length PLAY AUDIO seek when no cue sheet i…
2 parents bbace20 + e76ac24 commit f96b268

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lib/BlueSCSI_platform_RP2MCU/audio_i2s.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* Copyright (C) 2023 saybur
33
* Copyright (C) 2024-2025 Rabbit Hole Computing™
4+
* Copyright (c) 2026 Eric Helgeson <eric@bluescsi.com>
45
*
56
* This program is free software: you can redistribute it and/or modify
67
* it under the terms of the GNU General Public License as published by
@@ -181,6 +182,15 @@ static bool setup_playback(uint8_t id, uint32_t start, uint32_t length, bool con
181182
uint32_t start_of_next_track = 0;
182183
int file_index = -1;
183184

185+
// No cue parser exists until a cue sheet is loaded; plain .iso images never
186+
// load one. Win98 probes CD drives with zero-length PLAY AUDIO, which lands
187+
// here through the seek path before any playback has created the parser.
188+
if (g_cue_parser == nullptr)
189+
{
190+
dbgmsg("------ Audio setup - no cue sheet loaded, nothing to do");
191+
return false;
192+
}
193+
184194
g_cue_parser->restart();
185195

186196
while ((find_track_info = g_cue_parser->next_track(file_size)) != nullptr )

0 commit comments

Comments
 (0)