Commit 1270ebc00b97dbe0f3d609368090ab98b4ba7a82

Authored by Josh Klontz
1 parent ecbda287

a fix for my fix

Showing 1 changed file with 8 additions and 11 deletions
openbr/plugins/stream.cpp
@@ -323,19 +323,16 @@ struct StreamGallery : public TemplateProcessor @@ -323,19 +323,16 @@ struct StreamGallery : public TemplateProcessor
323 bool getNextTemplate(Template & output) 323 bool getNextTemplate(Template & output)
324 { 324 {
325 // If we still have data available, we return one of those 325 // If we still have data available, we return one of those
326 - if (nextIdx >= currentData.size())  
327 - {  
328 - // Otherwise, read another block  
329 - if (!lastBlock) {  
330 - currentData = gallery->readBlock(&lastBlock);  
331 - nextIdx = 0;  
332 - } 326 + if ((nextIdx >= currentData.size()) && !lastBlock) {
  327 + currentData = gallery->readBlock(&lastBlock);
  328 + nextIdx = 0;
  329 + }
333 330
334 - if (lastBlock || currentData.empty()) {  
335 - galleryOk = false;  
336 - return false;  
337 - } 331 + if (nextIdx >= currentData.size()) {
  332 + galleryOk = false;
  333 + return false;
338 } 334 }
  335 +
339 // Return the indicated template, and advance the index 336 // Return the indicated template, and advance the index
340 output = currentData[nextIdx++]; 337 output = currentData[nextIdx++];
341 return true; 338 return true;