PVS: V595 A pointer was utilized before it was verified against nullptr

This commit is contained in:
wmayer
2020-07-17 17:03:50 +02:00
parent d8ee57c0a1
commit 2a50ac2252
7 changed files with 27 additions and 24 deletions

View File

@@ -103,16 +103,16 @@ App::DocumentObjectExecReturn *DrawViewArch::execute(void)
}
App::DocumentObject* sourceObj = Source.getValue();
//if (sourceObj is not ArchSection) return
App::Property* proxy = sourceObj->getPropertyByName("Proxy");
if (proxy == nullptr) {
Base::Console().Error("DVA::execute - %s is not an ArchSection\n", sourceObj->Label.getValue());
//this is definitely not an ArchSection
return DrawView::execute();
}
if (sourceObj) {
std::string svgFrag;
//if (sourceObj is not ArchSection) return
App::Property* proxy = sourceObj->getPropertyByName("Proxy");
if (proxy == nullptr) {
Base::Console().Error("DVA::execute - %s is not an ArchSection\n", sourceObj->Label.getValue());
//this is definitely not an ArchSection
return DrawView::execute();
}
//std::string svgFrag;
std::string svgHead = getSVGHead();
std::string svgTail = getSVGTail();
std::string FeatName = getNameInDocument();

View File

@@ -39,7 +39,7 @@
#include <Base/FileInfo.h>
#include <Base/Parameter.h>
#include "Preferences.h"
#include "Preferences.h"
#include "DrawViewSpreadsheet.h"
#include <Mod/Spreadsheet/App/Cell.h>
@@ -63,7 +63,7 @@ DrawViewSpreadsheet::DrawViewSpreadsheet(void)
Source.setScope(App::LinkScope::Global);
ADD_PROPERTY_TYPE(CellStart ,("A1"),vgroup,App::Prop_None,"The top left cell of the range to display");
ADD_PROPERTY_TYPE(CellEnd ,("B2"),vgroup,App::Prop_None,"The bottom right cell of the range to display");
ADD_PROPERTY_TYPE(Font ,(Preferences::labelFont().c_str()),
ADD_PROPERTY_TYPE(Font ,(Preferences::labelFont().c_str()),
vgroup,App::Prop_None,"The name of the font to use");
ADD_PROPERTY_TYPE(TextColor,(0.0f,0.0f,0.0f),vgroup,App::Prop_None,"The default color of the text and lines");
ADD_PROPERTY_TYPE(TextSize,(12.0),vgroup,App::Prop_None,"The size of the text");
@@ -259,7 +259,7 @@ std::string DrawViewSpreadsheet::getSheetImage(void)
// get the text
App::Property* prop = sheet->getPropertyByName(address.toString().c_str());
std::stringstream field;
if (prop != 0) {
if (prop && cell) {
if (prop->isDerivedFrom((App::PropertyQuantity::getClassTypeId()))) {
field << cell->getFormattedQuantity();
} else if (prop->isDerivedFrom((App::PropertyFloat::getClassTypeId()))) {

View File

@@ -318,9 +318,7 @@ void CmdTechDrawView::activated(int iMsg)
}
//not a Link and not null. assume to be drawable. Undrawables will be
// skipped later.
if (obj != nullptr) {
shapes.push_back(obj);
}
shapes.push_back(obj);
if(partObj != nullptr) {
continue;
}
@@ -576,9 +574,7 @@ void CmdTechDrawProjectionGroup::activated(int iMsg)
}
//not a Link and not null. assume to be drawable. Undrawables will be
// skipped later.
if (obj != nullptr) {
shapes.push_back(obj);
}
shapes.push_back(obj);
if(partObj != nullptr) {
continue;
}

View File

@@ -289,8 +289,8 @@ void QGEPath::clearMarkers()
return;
}
for (auto& m: m_markers) {
m->hide();
if (m != nullptr) {
m->hide();
QGraphicsScene* s = m->scene();
if (s != nullptr) {
s->removeItem(m); //should this be setParentItem(nullptr) instead??