Skip to content

Commit 50db14b

Browse files
authored
[fix] dvl test: check pointer in TearDown
The TearDown unconditionally dereferences the engine pointer, which segfaults if the engine failed to load. Check the pointer before dereferencing. Signed-off-by: Steve Peters <scpeters@openrobotics.org>
1 parent c9eb325 commit 50db14b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/integration/dvl.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,11 @@ class DopplerVelocityLogTest : public testing::Test,
240240
// Documentation inherited
241241
protected: void TearDown() override
242242
{
243-
engine->DestroyScene(scene);
244-
rendering::unloadEngine(engine->Name());
243+
if (engine)
244+
{
245+
engine->DestroyScene(scene);
246+
rendering::unloadEngine(engine->Name());
247+
}
245248
}
246249

247250
rendering::RenderEngine *engine{nullptr};

0 commit comments

Comments
 (0)