From ed3022ae51e8e43e10b8c72122e8ef149065e821 Mon Sep 17 00:00:00 2001 From: Ronan Le Tiec Date: Sat, 23 May 2020 13:10:25 +0200 Subject: [PATCH] isEmpty test of graphic piece --- src/app/puzzle/vpuzzlegraphicspiece.cpp | 28 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/app/puzzle/vpuzzlegraphicspiece.cpp b/src/app/puzzle/vpuzzlegraphicspiece.cpp index 3d53423fe..30f1af656 100644 --- a/src/app/puzzle/vpuzzlegraphicspiece.cpp +++ b/src/app/puzzle/vpuzzlegraphicspiece.cpp @@ -74,22 +74,30 @@ void VPuzzleGraphicsPiece::Init() // initialises the seam line QVector seamLinePoints = m_piece->GetSeamLine(); - m_seamLine.moveTo(seamLinePoints.first()); - for (int i = 1; i < seamLinePoints.size(); ++i) - m_seamLine.lineTo(seamLinePoints.at(i)); + if(!seamLinePoints.isEmpty()) + { + m_seamLine.moveTo(seamLinePoints.first()); + for (int i = 1; i < seamLinePoints.size(); ++i) + m_seamLine.lineTo(seamLinePoints.at(i)); + } // initiliases the cutting line QVector cuttingLinepoints = m_piece->GetCuttingLine(); - m_cuttingLine.moveTo(cuttingLinepoints.first()); - for (int i = 1; i < cuttingLinepoints.size(); ++i) - m_cuttingLine.lineTo(cuttingLinepoints.at(i)); + if(!cuttingLinepoints.isEmpty()) + { + m_cuttingLine.moveTo(cuttingLinepoints.first()); + for (int i = 1; i < cuttingLinepoints.size(); ++i) + m_cuttingLine.lineTo(cuttingLinepoints.at(i)); + } // initialises the grainline QVector grainLinepoints = m_piece->GetGrainline(); - m_grainline.moveTo(grainLinepoints.first()); - for (int i = 1; i < grainLinepoints.size(); ++i) - m_grainline.lineTo(grainLinepoints.at(i)); - + if(!grainLinepoints.isEmpty()) + { + m_grainline.moveTo(grainLinepoints.first()); + for (int i = 1; i < grainLinepoints.size(); ++i) + m_grainline.lineTo(grainLinepoints.at(i)); + } // TODO : initialises the other elements labels, passmarks etc.