Skip to content

Commit

Permalink
fix: preview render crash on small/empty bit containers
Browse files Browse the repository at this point in the history
  • Loading branch information
hello-adam committed May 8, 2020
1 parent 500acd5 commit d58ad89
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/hobbits-core/previewscrollbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ void PreviewScrollBar::newContainer()

QImage PreviewScrollBar::renderPreview(QSharedPointer<BitContainer> container, QSharedPointer<ActionRenderProgress> progress)
{
if (container->bitInfo()->maxFrameWidth() < 8 || container->frames().size() < 1) {
return QImage();
}
int width = int(container->bitInfo()->maxFrameWidth() / 8);
int height = qMin(10000, container->frames().size());
QImage image(width, height, QImage::Format_ARGB32);
Expand Down

0 comments on commit d58ad89

Please sign in to comment.