diff --git a/src/App/GroupExtension.cpp b/src/App/GroupExtension.cpp index 1d2e677876..21341fec2e 100644 --- a/src/App/GroupExtension.cpp +++ b/src/App/GroupExtension.cpp @@ -56,7 +56,7 @@ DocumentObject* GroupExtension::addObject(const char* sType, const char* pObject getExtendedObject()->getDocument()->removeObject(obj->getNameInDocument()); return nullptr; } - if (obj) addObject(obj); + addObject(obj); return obj; } diff --git a/src/Gui/DownloadItem.cpp b/src/Gui/DownloadItem.cpp index 10f78346e2..b882df8e81 100644 --- a/src/Gui/DownloadItem.cpp +++ b/src/Gui/DownloadItem.cpp @@ -520,19 +520,17 @@ void DownloadItem::metaDataChanged() if (url != redirectUrl) { url = redirectUrl; - if (m_reply) { - disconnect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead())); - disconnect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), - this, SLOT(error(QNetworkReply::NetworkError))); - disconnect(m_reply, SIGNAL(downloadProgress(qint64, qint64)), - this, SLOT(downloadProgress(qint64, qint64))); - disconnect(m_reply, SIGNAL(metaDataChanged()), - this, SLOT(metaDataChanged())); - disconnect(m_reply, SIGNAL(finished()), - this, SLOT(finished())); - m_reply->close(); - m_reply->deleteLater(); - } + disconnect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead())); + disconnect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), + this, SLOT(error(QNetworkReply::NetworkError))); + disconnect(m_reply, SIGNAL(downloadProgress(qint64, qint64)), + this, SLOT(downloadProgress(qint64, qint64))); + disconnect(m_reply, SIGNAL(metaDataChanged()), + this, SLOT(metaDataChanged())); + disconnect(m_reply, SIGNAL(finished()), + this, SLOT(finished())); + m_reply->close(); + m_reply->deleteLater(); m_reply = DownloadManager::getInstance()->networkAccessManager()->get(QNetworkRequest(url)); init(); diff --git a/src/Mod/Mesh/Gui/SoFCMeshObject.cpp b/src/Mod/Mesh/Gui/SoFCMeshObject.cpp index a0c9ac4cdd..cf930253d5 100644 --- a/src/Mod/Mesh/Gui/SoFCMeshObject.cpp +++ b/src/Mod/Mesh/Gui/SoFCMeshObject.cpp @@ -242,18 +242,19 @@ SbBool SoSFMeshObject::readValue(SoInput *in) // This writes the value of a field to a file. void SoSFMeshObject::writeValue(SoOutput *out) const { - if (!out->isBinary()) { - SoOutputStream str(out); - MeshCore::MeshOutput(value->getKernel()).SaveMeshNode(str); - return; - } - if (!value) { int32_t count = 0; out->write(count); out->write(count); return; } + + if (!out->isBinary()) { + SoOutputStream str(out); + MeshCore::MeshOutput(value->getKernel()).SaveMeshNode(str); + return; + } + const MeshCore::MeshPointArray& rPoints = value->getKernel().GetPoints(); std::vector verts; verts.reserve(3*rPoints.size()); diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index b92430a89c..e2bfe44155 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -828,7 +828,6 @@ void TaskAttacher::updateListOfModes() } } else if (mmode == this->lastSuggestResult.bestFitMode){ //suggested mode - make bold - assert (item); QFont fnt = item->font(); fnt.setBold(true); item->setFont(fnt); diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 8dc2b0c591..9d16e4aca2 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -614,7 +614,7 @@ void CmdPartDesignNewSketch::activated(int iMsg) for (auto plane: datumPlanes) { planes.push_back ( plane ); // Check whether this plane belongs to the active body - if ( pcActiveBody && pcActiveBody->hasObject(plane) ) { + if ( pcActiveBody->hasObject(plane) ) { if ( !pcActiveBody->isAfterInsertPoint ( plane ) ) { validPlaneCount++; status.push_back(PartDesignGui::TaskFeaturePick::validFeature); @@ -648,7 +648,7 @@ void CmdPartDesignNewSketch::activated(int iMsg) auto shapeBinders( getDocument()->getObjectsOfType(PartDesign::ShapeBinder::getClassTypeId()) ); for (auto binder : shapeBinders) { // Check whether this plane belongs to the active body - if (pcActiveBody && pcActiveBody->hasObject(binder)) { + if (pcActiveBody->hasObject(binder)) { TopoDS_Shape shape = static_cast(binder)->Shape.getValue(); if (!shape.IsNull() && shape.ShapeType() == TopAbs_FACE) { const TopoDS_Face& face = TopoDS::Face(shape); diff --git a/src/Mod/PartDesign/Gui/CommandPrimitive.cpp b/src/Mod/PartDesign/Gui/CommandPrimitive.cpp index 5bcdfafd99..61b771600b 100644 --- a/src/Mod/PartDesign/Gui/CommandPrimitive.cpp +++ b/src/Mod/PartDesign/Gui/CommandPrimitive.cpp @@ -105,6 +105,10 @@ void CmdPrimtiveCompAdditive::activated(int iMsg) pcActiveBody = PartDesignGui::makeBody(doc); } + if (pcActiveBody == nullptr) { + return; + } + Gui::Command::doCommand( Gui::Command::Doc, "App.ActiveDocument.addObject(\'PartDesign::Additive%s\',\'%s\')", @@ -118,13 +122,11 @@ void CmdPrimtiveCompAdditive::activated(int iMsg) if (prm->BaseFeature.getValue()) doCommand(Gui,"Gui.activeDocument().hide(\"%s\")", prm->BaseFeature.getValue()->getNameInDocument()); - if (pcActiveBody) { - copyVisual(FeatName.c_str(), "ShapeColor", pcActiveBody->getNameInDocument()); - copyVisual(FeatName.c_str(), "LineColor", pcActiveBody->getNameInDocument()); - copyVisual(FeatName.c_str(), "PointColor", pcActiveBody->getNameInDocument()); - copyVisual(FeatName.c_str(), "Transparency", pcActiveBody->getNameInDocument()); - copyVisual(FeatName.c_str(), "DisplayMode", pcActiveBody->getNameInDocument()); - } + copyVisual(FeatName.c_str(), "ShapeColor", pcActiveBody->getNameInDocument()); + copyVisual(FeatName.c_str(), "LineColor", pcActiveBody->getNameInDocument()); + copyVisual(FeatName.c_str(), "PointColor", pcActiveBody->getNameInDocument()); + copyVisual(FeatName.c_str(), "Transparency", pcActiveBody->getNameInDocument()); + copyVisual(FeatName.c_str(), "DisplayMode", pcActiveBody->getNameInDocument()); Gui::Command::doCommand(Gui, "Gui.activeDocument().setEdit(\'%s\')", FeatName.c_str()); } diff --git a/src/Mod/TechDraw/Gui/QGVPage.cpp b/src/Mod/TechDraw/Gui/QGVPage.cpp index 42bc7a33cb..cc2b861028 100644 --- a/src/Mod/TechDraw/Gui/QGVPage.cpp +++ b/src/Mod/TechDraw/Gui/QGVPage.cpp @@ -143,6 +143,10 @@ void QGVPage::drawBackground(QPainter *p, const QRectF &) if(!drawBkg) return; + if(!m_vpPage) { + return; + } + if (!m_vpPage->getDrawPage()) { //Base::Console().Log("TROUBLE - QGVP::drawBackground - no Page Object!\n"); return; @@ -155,10 +159,6 @@ void QGVPage::drawBackground(QPainter *p, const QRectF &) p->setBrush(*bkgBrush); p->drawRect(viewport()->rect().adjusted(-2,-2,2,2)); //just bigger than viewport to prevent artifacts - if(!m_vpPage) { - return; - } - // Default to A3 landscape, though this is currently relevant // only for opening corrupt docs, etc. float pageWidth = 420,