fix(param): restore half-open interval bound in param_find binary search

The grouped-parameter refactor changed `last = param_info_count` to
`last = param_info_count - 1` in `param_find_internal`. The binary
search uses a half-open interval (`front <= last`, with `middle ==
front` as the termination condition), so shrinking `last` by one made
the highest-named parameter unreachable. SITL exportImportAll caught
this: BSON verify rejected `WV_YRATE_MAX` as `invalid parameter`,
making `param_save_default` fail and tripping the `sitl-parameters`
ctest.

Restore the original upper bound. The added nullptr guards remain
since they harden the path against an unset `param_info_count`.

Signed-off-by: Nuno Marques <n.marques21@hotmail.com>
This commit is contained in:
Nuno Marques
2026-05-07 16:43:27 -07:00
parent 7be68c5ebc
commit a7600b54e6
+1 -1
View File
@@ -189,7 +189,7 @@ static param_t param_find_internal(const char *name, bool notification)
param_t middle;
param_t front = 0;
param_t last = param_info_count - 1;
param_t last = param_info_count;
/* perform a binary search of the known parameters */