mirror of
https://gitlab.com/smart-pattern/valentina.git
synced 2024-09-19 23:34:04 +02:00
Fix potential issues with ACCESS_VIOLATION_READ.
This commit is contained in:
parent
42ced535cb
commit
f1d0c89f83
|
@ -4668,15 +4668,19 @@ template <typename T> auto VPattern::ToolBoundingRect(const QRectF &rec, quint32
|
||||||
QRectF recTool = rec;
|
QRectF recTool = rec;
|
||||||
if (tools.contains(id))
|
if (tools.contains(id))
|
||||||
{
|
{
|
||||||
const T *vTool = qobject_cast<T *>(tools.value(id));
|
if (const T *vTool = qobject_cast<T *>(tools.value(id)); vTool != nullptr)
|
||||||
SCASSERT(vTool != nullptr)
|
{
|
||||||
|
QRectF childrenRect = vTool->childrenBoundingRect();
|
||||||
|
// map to scene coordinate.
|
||||||
|
childrenRect.translate(vTool->scenePos());
|
||||||
|
|
||||||
QRectF childrenRect = vTool->childrenBoundingRect();
|
recTool = recTool.united(vTool->sceneBoundingRect());
|
||||||
// map to scene coordinate.
|
recTool = recTool.united(childrenRect);
|
||||||
childrenRect.translate(vTool->scenePos());
|
}
|
||||||
|
else
|
||||||
recTool = recTool.united(vTool->sceneBoundingRect());
|
{
|
||||||
recTool = recTool.united(childrenRect);
|
qDebug() << "qobject_cast failed for tool with id=" << id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue