disk.c ensure a valid volume is returned from get_free_volume()

volume is used for element math and indexing into buffers
-1  volume is bad

Change-Id: I1ec75ef3a848c154ea80905224ea9a3a14bf8151
This commit is contained in:
William Wilgus 2021-08-03 22:22:02 -04:00 committed by William Wilgus
parent d57900ae12
commit cb6b0d2c0e
1 changed files with 7 additions and 0 deletions

View File

@ -174,6 +174,13 @@ int disk_mount(int drive)
int volume = get_free_volume();
if (volume < 0)
{
DEBUGF("No Free Volumes\n");
disk_writer_unlock();
return 0;
}
if (!disk_init(IF_MD(drive)))
{
disk_writer_unlock();