From 8d5ceda534d4e1fc8af00eea7421f8b79fbc0f6c Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 16 May 2016 13:02:25 +1000 Subject: [PATCH] AP_HAL_SITL: ensure specified SITL model is found Without this check we get a null pointer exception the first time we attempt to use the model object --- libraries/AP_HAL_SITL/SITL_cmdline.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/AP_HAL_SITL/SITL_cmdline.cpp b/libraries/AP_HAL_SITL/SITL_cmdline.cpp index a9a6ab4df7..7f1a2dcf03 100644 --- a/libraries/AP_HAL_SITL/SITL_cmdline.cpp +++ b/libraries/AP_HAL_SITL/SITL_cmdline.cpp @@ -248,6 +248,10 @@ void SITL_State::_parse_command_line(int argc, char * const argv[]) break; } } + if (sitl_model == nullptr) { + printf("Vehicle model (%s) not found\n", model_str); + exit(1); + } fprintf(stdout, "Starting sketch '%s'\n", SKETCH);