From ddc805a534725b06a3e172014add5a0c68cb1b38 Mon Sep 17 00:00:00 2001 From: gitlost Date: Mon, 19 Dec 2022 10:34:25 +0000 Subject: [PATCH] Guard against empty frames in `Model::w()` and `Model::h()` to avoid QList ASSERT being triggered in `TestModel::model()`. --- model/Model.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model/Model.cpp b/model/Model.cpp index 4bcf47fc..17be4d40 100644 --- a/model/Model.cpp +++ b/model/Model.cpp @@ -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(); } @@ -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(); }