Check if requested parameters indexes are correct

In case if gcs gets crazy and requests incorrect parameter index
This commit is contained in:
Oleg Kalachev 2025-01-14 21:14:04 +03:00
parent b915e47f33
commit 740121a88e

View File

@ -89,10 +89,12 @@ int parametersCount() {
} }
const char *getParameterName(int index) { const char *getParameterName(int index) {
if (index < 0 || index >= parametersCount()) return "";
return parameters[index].name; return parameters[index].name;
} }
float getParameter(int index) { float getParameter(int index) {
if (index < 0 || index >= parametersCount()) return NAN;
return *parameters[index].variable; return *parameters[index].variable;
} }