Skip calibration data for invalid analogs

This commit is contained in:
Raphael Coeffic
2021-12-31 18:41:59 +01:00
parent ede80e2ebd
commit 8e69976dbb
2 changed files with 6 additions and 1 deletions
@@ -463,6 +463,11 @@ static uint32_t r_calib(void* user, const char* val, uint8_t val_len)
uint32_t sw = yaml_parse_enum(enum_MixSources, val, val_len);
if (sw >= MIXSRC_Rud) return sw - MIXSRC_Rud;
// detect invalid values
if (val_len == 0 || (val[0] < '0') || (val[0] > '9')) {
return -1;
}
return (uint32_t)yaml_str2int(val, val_len);
}
+1 -1
View File
@@ -301,7 +301,7 @@ bool YamlTreeWalker::toParent()
bool YamlTreeWalker::toChild()
{
const struct YamlNode* attr = getAttr();
if (!attr
if (!attr || isIdxInvalid()
|| (attr->type != YDT_ARRAY
&& attr->type != YDT_UNION
&& !isArrayElmt())) {