From 45088c3448a14b7bf7f48352a6977881a47ecd97 Mon Sep 17 00:00:00 2001 From: Anton Fedchin Date: Mon, 25 Dec 2017 17:51:19 +0300 Subject: [PATCH] fixup! possible invalid value of preset index --- src/MilkdropXBMC.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/MilkdropXBMC.cpp b/src/MilkdropXBMC.cpp index 2142693..5c36733 100644 --- a/src/MilkdropXBMC.cpp +++ b/src/MilkdropXBMC.cpp @@ -87,6 +87,8 @@ void SetPresetDir(const char *pack) if (g_plugin->m_pPresetAddr) { g_plugin->m_bHoldPreset = lastLockedStatus; + if (lastPresetIndx < 0 || lastPresetIndx >(g_plugin->m_nPresets - g_plugin->m_nDirs)) + lastPresetIndx = 0; g_plugin->m_nCurrentPreset = lastPresetIndx; strcpy(g_plugin->m_szCurrentPresetFile, g_plugin->m_szPresetDir); strcat(g_plugin->m_szCurrentPresetFile, g_plugin->m_pPresetAddr[g_plugin->m_nCurrentPreset]);