From 57f73e59b790429e152538d8acace278d665a492 Mon Sep 17 00:00:00 2001 From: tumbili Date: Tue, 3 May 2016 14:38:51 +0200 Subject: [PATCH] warn immediately if ekf2 instance allocation has failed --- src/modules/ekf2/ekf2_main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/ekf2/ekf2_main.cpp b/src/modules/ekf2/ekf2_main.cpp index f2ed912901..051b0f8b49 100644 --- a/src/modules/ekf2/ekf2_main.cpp +++ b/src/modules/ekf2/ekf2_main.cpp @@ -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;