PVS: V595 The pointer was utilized before it was verified against nullptr
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<float> verts;
|
||||
verts.reserve(3*rPoints.size());
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<Part::Feature*>(binder)->Shape.getValue();
|
||||
if (!shape.IsNull() && shape.ShapeType() == TopAbs_FACE) {
|
||||
const TopoDS_Face& face = TopoDS::Face(shape);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user