warn immediately if ekf2 instance allocation has failed

This commit is contained in:
tumbili
2016-05-03 16:09:26 +02:00
parent 9f5e9594f5
commit 57f73e59b7
+5 -5
View File
@@ -902,17 +902,17 @@ int ekf2_main(int argc, char *argv[])
ekf2::instance = new Ekf2();
if (ekf2::instance == nullptr) {
PX4_WARN("alloc failed");
return 1;
}
if (argc >= 3) {
if (!strcmp(argv[2], "--replay")) {
ekf2::instance->set_replay_mode(true);
}
}
if (ekf2::instance == nullptr) {
PX4_WARN("alloc failed");
return 1;
}
if (OK != ekf2::instance->start()) {
delete ekf2::instance;
ekf2::instance = nullptr;