From 10e4a78398f209aab548c886fb64da1d4361efd9 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 7 Jan 2014 23:40:38 +0100 Subject: [PATCH] Prevent crash when calling getTime() on an empty DTSC::Stream --- lib/dtsc.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/dtsc.cpp b/lib/dtsc.cpp index e1a2ef0b..2e9690b0 100644 --- a/lib/dtsc.cpp +++ b/lib/dtsc.cpp @@ -34,6 +34,9 @@ void DTSC::Stream::deletionCallback(livePos deleting){} /// Returns the time in milliseconds of the last received packet. /// This is _not_ the time this packet was received, only the stored time. unsigned int DTSC::Stream::getTime(){ + if ( !buffers.size()){ + return 0; + } return buffers.rbegin()->second["time"].asInt(); }