Commit dfb71de928bccd40f2e7c50de810ca811875791d

Authored by Josh Klontz
1 parent f3be8ec5

potential fix for StreamGallery empty template list

Showing 1 changed file with 6 additions and 14 deletions
openbr/plugins/stream.cpp
@@ -289,28 +289,22 @@ protected: @@ -289,28 +289,22 @@ protected:
289 }; 289 };
290 290
291 291
292 -class StreamGallery : public TemplateProcessor 292 +struct StreamGallery : public TemplateProcessor
293 { 293 {
294 -public:  
295 - StreamGallery()  
296 - {  
297 -  
298 - }  
299 -  
300 bool open(Template &input) 294 bool open(Template &input)
301 { 295 {
302 // Create a gallery 296 // Create a gallery
303 gallery = QSharedPointer<Gallery>(Gallery::make(input.file)); 297 gallery = QSharedPointer<Gallery>(Gallery::make(input.file));
304 - // Failed ot open the gallery? 298 + // Failed to open the gallery?
305 if (gallery.isNull()) { 299 if (gallery.isNull()) {
306 - qDebug()<<"Failed to create gallery!"; 300 + qDebug("Failed to create gallery!");
307 galleryOk = false; 301 galleryOk = false;
308 return false; 302 return false;
309 } 303 }
310 304
311 // Set up state variables for future reads 305 // Set up state variables for future reads
312 galleryOk = true; 306 galleryOk = true;
313 - gallery->set_readBlockSize(100); 307 + gallery->readBlockSize = 100;
314 nextIdx = 0; 308 nextIdx = 0;
315 lastBlock = false; 309 lastBlock = false;
316 return galleryOk; 310 return galleryOk;
@@ -334,12 +328,10 @@ public: @@ -334,12 +328,10 @@ public:
334 // Otherwise, read another block 328 // Otherwise, read another block
335 if (!lastBlock) { 329 if (!lastBlock) {
336 currentData = gallery->readBlock(&lastBlock); 330 currentData = gallery->readBlock(&lastBlock);
337 - if (currentData.empty())  
338 - qFatal("Expected at least one template.");  
339 nextIdx = 0; 331 nextIdx = 0;
340 } 332 }
341 - else  
342 - { 333 +
  334 + if (lastBlock || currentData.empty()) {
343 galleryOk = false; 335 galleryOk = false;
344 return false; 336 return false;
345 } 337 }