mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-20 15:17:34 +08:00
circuit_breaker: prevent param fetch failure from disabling safety switch
if the param get failed then an uninitialised stack variable was used for the safety disable on boot. In ArduPilot that value happened to equal the correct magic due to stack passing from caller. This forced safety off on boot
This commit is contained in:
committed by
Lorenz Meier
parent
3c349236e1
commit
d290487382
@@ -48,9 +48,10 @@
|
||||
|
||||
bool circuit_breaker_enabled(const char *breaker, int32_t magic)
|
||||
{
|
||||
int32_t val;
|
||||
(void)PX4_PARAM_GET_BYNAME(breaker, &val);
|
||||
|
||||
return (val == magic);
|
||||
int32_t val = -1;
|
||||
if (PX4_PARAM_GET_BYNAME(breaker, &val) == 0 && val == magic) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user