Skip to content

Commit

Permalink
Guard against empty frames in Model::w() and Model::h()
Browse files Browse the repository at this point in the history
to avoid QList ASSERT being triggered in `TestModel::model()`.
  • Loading branch information
gitlost committed Dec 18, 2023
1 parent 6f0835c commit 7c853f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions model/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ namespace glabels
///
Distance Model::w() const
{
if ( auto* frame = mTmplate.frames().constFirst() )
if ( auto* frame = !mTmplate.frames().isEmpty() ? mTmplate.frames().constFirst() : nullptr )
{
return mRotate ? frame->h() : frame->w();
}
Expand All @@ -251,7 +251,7 @@ namespace glabels
///
Distance Model::h() const
{
if ( auto* frame = mTmplate.frames().constFirst() )
if ( auto* frame = !mTmplate.frames().isEmpty() ? mTmplate.frames().constFirst() : nullptr )
{
return mRotate ? frame->w() : frame->h();
}
Expand Down

0 comments on commit 7c853f6

Please sign in to comment.