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 93f61a3154
commit 473553a212
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()))) {