Commit dfb71de928bccd40f2e7c50de810ca811875791d
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 | 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 | 294 | bool open(Template &input) |
| 301 | 295 | { |
| 302 | 296 | // Create a gallery |
| 303 | 297 | gallery = QSharedPointer<Gallery>(Gallery::make(input.file)); |
| 304 | - // Failed ot open the gallery? | |
| 298 | + // Failed to open the gallery? | |
| 305 | 299 | if (gallery.isNull()) { |
| 306 | - qDebug()<<"Failed to create gallery!"; | |
| 300 | + qDebug("Failed to create gallery!"); | |
| 307 | 301 | galleryOk = false; |
| 308 | 302 | return false; |
| 309 | 303 | } |
| 310 | 304 | |
| 311 | 305 | // Set up state variables for future reads |
| 312 | 306 | galleryOk = true; |
| 313 | - gallery->set_readBlockSize(100); | |
| 307 | + gallery->readBlockSize = 100; | |
| 314 | 308 | nextIdx = 0; |
| 315 | 309 | lastBlock = false; |
| 316 | 310 | return galleryOk; |
| ... | ... | @@ -334,12 +328,10 @@ public: |
| 334 | 328 | // Otherwise, read another block |
| 335 | 329 | if (!lastBlock) { |
| 336 | 330 | currentData = gallery->readBlock(&lastBlock); |
| 337 | - if (currentData.empty()) | |
| 338 | - qFatal("Expected at least one template."); | |
| 339 | 331 | nextIdx = 0; |
| 340 | 332 | } |
| 341 | - else | |
| 342 | - { | |
| 333 | + | |
| 334 | + if (lastBlock || currentData.empty()) { | |
| 343 | 335 | galleryOk = false; |
| 344 | 336 | return false; |
| 345 | 337 | } | ... | ... |