From 8db3779f7d5beb491b6be019b6dde6ae5e2a3a54 Mon Sep 17 00:00:00 2001 From: sluicebox <22204938+sluicebox@users.noreply.github.com> Date: Sat, 15 Apr 2023 15:33:07 -0700 Subject: [PATCH] AUDIO: Fix crash when OPL driver isn't loaded Fixes segfault when logging that an OPL driver doesn't support the emulation type requested by a game. The code used driver id as an array index, but this is incorrect because array indexes depends on which drivers are compiled in. This issue was identified and fixed in 2015, but this line was missed: 6f01600e12ba14acde8a6557716783861dc014d1 Fixes the crash in bug #14413 --- audio/fmopl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/fmopl.cpp b/audio/fmopl.cpp index c1a0a75f091..b881d7941d7 100644 --- a/audio/fmopl.cpp +++ b/audio/fmopl.cpp @@ -155,7 +155,7 @@ Config::DriverId Config::detect(OplType type) { } else { // Else we will output a warning and just // return that no valid driver is found. - warning("Your selected OPL driver \"%s\" does not support type %d emulation, which is requested by your game", _drivers[drv].description, type); + warning("Your selected OPL driver \"%s\" does not support type %d emulation, which is requested by your game", driverDesc->description, type); return -1; } }