From e6cb4eb72bd1f20ecdc9f9c2cca8e63829068a33 Mon Sep 17 00:00:00 2001
From: Ulrich Kemloh <kemlohulrich@gmail.com>
Date: Mon, 1 Jun 2015 13:54:03 +0200
Subject: [PATCH] fixed: memleak when the trajectories did not contain any
 frames

---
 src/ThreadVisualisation.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/ThreadVisualisation.cpp b/src/ThreadVisualisation.cpp
index 6aa9e2e..a447bea 100644
--- a/src/ThreadVisualisation.cpp
+++ b/src/ThreadVisualisation.cpp
@@ -503,7 +503,10 @@ void  ThreadVisualisation::initGlyphs2D()
     //extern_glyphs_pedestrians->SetSourceConnection(agentShape->GetOutputPort());
 
     //first frame
-    Frame * frame = extern_trajectories_firstSet.GetFrames().begin()->second;
+    auto&& frames=extern_trajectories_firstSet.GetFrames();
+    if(frames.empty()) return;
+
+    Frame * frame = frames.begin()->second;
 
     vtkPolyData* pData=NULL;
     if(frame) pData=frame->GetPolyData2D();
@@ -606,7 +609,11 @@ void ThreadVisualisation::initGlyphs3D()
     extern_glyphs_pedestrians_3D->SetSourceConnection(strip->GetOutputPort());
 
     //first frame
-    Frame * frame = extern_trajectories_firstSet.GetFrames().begin()->second;
+    auto&& frames=extern_trajectories_firstSet.GetFrames();
+    if(frames.empty()) return;
+
+    Frame * frame = frames.begin()->second;
+
     vtkPolyData* pData=NULL;
     if(frame) pData=frame->GetPolyData2D();
 
-- 
GitLab