AP_Param: correct possible use of nullptr during param count

::first can return nullptr
This commit is contained in:
Peter Barker 2018-04-01 01:40:41 +11:00 committed by Randy Mackay
parent ac283fb032
commit 32795f0a8f
1 changed files with 4 additions and 3 deletions

View File

@ -2095,10 +2095,11 @@ uint16_t AP_Param::count_parameters(void)
AP_Param *vp;
AP_Param::ParamToken token;
vp = AP_Param::first(&token, nullptr);
do {
for (vp = AP_Param::first(&token, nullptr);
vp != nullptr;
vp = AP_Param::next_scalar(&token, nullptr)) {
ret++;
} while (nullptr != (vp = AP_Param::next_scalar(&token, nullptr)));
}
_parameter_count = ret;
}
return ret;