mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 10:13:35 +08:00
fixing all "argc < 1" to avoid segmentation fault when calling the module with no parameters
argc is never smaller than one because the first element of the array is the program name!
This commit is contained in:
@@ -842,7 +842,7 @@ void AttitudeEstimatorQ::update_mag_declination(float new_declination)
|
||||
|
||||
int attitude_estimator_q_main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 1) {
|
||||
if (argc < 2) {
|
||||
warnx("usage: attitude_estimator_q {start|stop|status}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -751,7 +751,7 @@ int Ekf2::start()
|
||||
|
||||
int ekf2_main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 1) {
|
||||
if (argc < 2) {
|
||||
PX4_WARN("usage: ekf2 {start|stop|status}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ usage(const char *reason)
|
||||
int local_position_estimator_main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
if (argc < 1) {
|
||||
if (argc < 2) {
|
||||
usage("missing command");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user