Commit cadd9f8c992a1d81666bc1c7b697145d3cb17c83
1 parent
0cc51d5e
fixed #230, also changed stream.atEnd() to gallery.atEnd() for better clarity (n…
…o change in behavior intendend)
Showing
1 changed file
with
5 additions
and
4 deletions
openbr/plugins/gallery.cpp
| @@ -141,11 +141,11 @@ class BinaryGallery : public Gallery | @@ -141,11 +141,11 @@ class BinaryGallery : public Gallery | ||
| 141 | 141 | ||
| 142 | TemplateList readBlock(bool *done) | 142 | TemplateList readBlock(bool *done) |
| 143 | { | 143 | { |
| 144 | - if (stream.atEnd()) | 144 | + if (gallery.atEnd()) |
| 145 | gallery.seek(0); | 145 | gallery.seek(0); |
| 146 | 146 | ||
| 147 | TemplateList templates; | 147 | TemplateList templates; |
| 148 | - while ((templates.size() < readBlockSize) && !stream.atEnd()) { | 148 | + while ((templates.size() < readBlockSize) && !gallery.atEnd()) { |
| 149 | const Template t = readTemplate(); | 149 | const Template t = readTemplate(); |
| 150 | if (t.isEmpty() && t.file.isNull()) | 150 | if (t.isEmpty() && t.file.isNull()) |
| 151 | continue; | 151 | continue; |
| @@ -157,7 +157,7 @@ class BinaryGallery : public Gallery | @@ -157,7 +157,7 @@ class BinaryGallery : public Gallery | ||
| 157 | break; | 157 | break; |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | - *done = stream.atEnd(); | 160 | + *done = gallery.atEnd(); |
| 161 | return templates; | 161 | return templates; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| @@ -255,7 +255,8 @@ class utGallery : public BinaryGallery | @@ -255,7 +255,8 @@ class utGallery : public BinaryGallery | ||
| 255 | t.file.set("URL", QString(data.data())); | 255 | t.file.set("URL", QString(data.data())); |
| 256 | t.append(cv::Mat(1, ut.size - ut.urlSize, CV_8UC1, data.data() + ut.urlSize).clone() /* We don't want a shallow copy! */); | 256 | t.append(cv::Mat(1, ut.size - ut.urlSize, CV_8UC1, data.data() + ut.urlSize).clone() /* We don't want a shallow copy! */); |
| 257 | } else { | 257 | } else { |
| 258 | - qFatal("Failed to read universal template header!"); | 258 | + if (!gallery.atEnd()) |
| 259 | + qFatal("Failed to read universal template header!"); | ||
| 259 | } | 260 | } |
| 260 | return t; | 261 | return t; |
| 261 | } | 262 | } |