Potential fix for code scanning alert no. 9: Array offset used before range check (#769)

Very minor fix for damaged SoundFont files.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
Earle F. Philhower, IIIandCopilot Autofix powered by AI authored and GitHub committed 2025-10-08 09:21:26 -07:00
1 parent b09bad5b9c
commit 402278ab11
1 file changed
+1 -1
+1 -1
View File
@@ -1871,7 +1871,7 @@ TSFDEF int tsf_get_presetcount(const tsf* f) {
}
TSFDEF const char* tsf_get_presetname(const tsf* f, int preset) {
if (f->presets[preset].regions == NULL && preset >= 0 && preset < f->presetNum) {
if (preset >= 0 && preset < f->presetNum && f->presets[preset].regions == NULL) {
tsf_load_preset(f, f->hydra, preset);
}
return (preset < 0 || preset >= f->presetNum ? TSF_NULL : f->presets[preset].presetName);