mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 16:01:35 +08:00
gpssim: fix seg fault if not enough arguments
happens with e.g. 'gpssim -f'
This commit is contained in:
committed by
Beat Küng
parent
2436a27848
commit
6843155357
@@ -558,11 +558,6 @@ usage(const char *reason)
|
|||||||
int
|
int
|
||||||
gpssim_main(int argc, char *argv[])
|
gpssim_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (argc < 2) {
|
|
||||||
gpssim::usage("not enough arguments supplied");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set to default
|
// set to default
|
||||||
const char *device_name = GPS_DEFAULT_UART_PORT;
|
const char *device_name = GPS_DEFAULT_UART_PORT;
|
||||||
bool fake_gps = false;
|
bool fake_gps = false;
|
||||||
@@ -595,6 +590,11 @@ gpssim_main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (myoptind >= argc) {
|
||||||
|
gpssim::usage("not enough arguments supplied");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start/load the driver.
|
* Start/load the driver.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user