From 1270ebc00b97dbe0f3d609368090ab98b4ba7a82 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Fri, 13 Jun 2014 15:51:10 -0400 Subject: [PATCH] a fix for my fix --- openbr/plugins/stream.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/openbr/plugins/stream.cpp b/openbr/plugins/stream.cpp index dcc2537..6220a05 100644 --- a/openbr/plugins/stream.cpp +++ b/openbr/plugins/stream.cpp @@ -323,19 +323,16 @@ struct StreamGallery : public TemplateProcessor bool getNextTemplate(Template & output) { // If we still have data available, we return one of those - if (nextIdx >= currentData.size()) - { - // Otherwise, read another block - if (!lastBlock) { - currentData = gallery->readBlock(&lastBlock); - nextIdx = 0; - } + if ((nextIdx >= currentData.size()) && !lastBlock) { + currentData = gallery->readBlock(&lastBlock); + nextIdx = 0; + } - if (lastBlock || currentData.empty()) { - galleryOk = false; - return false; - } + if (nextIdx >= currentData.size()) { + galleryOk = false; + return false; } + // Return the indicated template, and advance the index output = currentData[nextIdx++]; return true; -- libgit2 0.21.4