From 62c4689ae2cc5f1d017edbe790ac800fb54951b2 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 21 May 2013 13:21:07 +0200 Subject: [PATCH] Fixed a potential threading problem in DTSC::Stream. --- lib/dtsc.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/dtsc.cpp b/lib/dtsc.cpp index 1937fd66..b2f3455f 100644 --- a/lib/dtsc.cpp +++ b/lib/dtsc.cpp @@ -189,6 +189,10 @@ std::string & DTSC::Stream::lastData(){ /// Returns the packet in this buffer number. /// \arg num Buffer number. JSON::Value & DTSC::Stream::getPacket(unsigned int num){ + static JSON::Value empty; + if (num >= buffers.size()){ + return empty; + } return buffers[num]; }