PVS: V595 A pointer was utilized before it was verified against nullptr
This commit is contained in:
@@ -412,7 +412,7 @@ void PropertyView::onTimer() {
|
||||
vp->getPropertyMap(viewList);
|
||||
|
||||
// store the properties with <name,id> as key in a map
|
||||
if (ob) {
|
||||
{
|
||||
for (auto prop : dataList) {
|
||||
if (isPropertyHidden(prop))
|
||||
continue;
|
||||
@@ -432,7 +432,7 @@ void PropertyView::onTimer() {
|
||||
}
|
||||
}
|
||||
// the same for the view properties
|
||||
if (vp) {
|
||||
{
|
||||
std::map<std::string, App::Property*>::iterator pt;
|
||||
for (pt = viewList.begin(); pt != viewList.end(); ++pt) {
|
||||
if (isPropertyHidden(pt->second))
|
||||
|
||||
@@ -196,7 +196,8 @@ void ViewProviderDocumentObject::onChanged(const App::Property* prop)
|
||||
if (!testStatus(Gui::ViewStatus::TouchDocument)) {
|
||||
bool mod = pcDocument->isModified();
|
||||
getObject()->Visibility.setValue(Visibility.getValue());
|
||||
pcDocument->setModified(mod);
|
||||
if (pcDocument)
|
||||
pcDocument->setModified(mod);
|
||||
}
|
||||
else {
|
||||
getObject()->Visibility.setValue(Visibility.getValue());
|
||||
|
||||
@@ -2194,13 +2194,16 @@ std::string ViewProviderLink::dropObjectEx(App::DocumentObject* obj,
|
||||
const std::vector<std::string> &subElements)
|
||||
{
|
||||
auto ext = getLinkExtension();
|
||||
if (!ext)
|
||||
return std::string();
|
||||
|
||||
if(isGroup(ext)) {
|
||||
size_t size = ext->getElementListValue().size();
|
||||
ext->setLink(size,obj);
|
||||
return std::to_string(size)+".";
|
||||
}
|
||||
|
||||
if(!ext || !ext->getLinkedObjectProperty() || hasElements(ext))
|
||||
if(!ext->getLinkedObjectProperty() || hasElements(ext))
|
||||
return std::string();
|
||||
|
||||
if(!hasSubName) {
|
||||
@@ -2333,6 +2336,9 @@ bool ViewProviderLink::doubleClicked() {
|
||||
void ViewProviderLink::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
|
||||
{
|
||||
auto ext = getLinkExtension();
|
||||
if (!ext)
|
||||
return;
|
||||
|
||||
if(linkEdit(ext)) {
|
||||
linkView->getLinkedView()->setupContextMenu(menu,receiver,member);
|
||||
} else if(ext->getPlacementProperty() || ext->getLinkPlacementProperty()) {
|
||||
@@ -2340,7 +2346,7 @@ void ViewProviderLink::setupContextMenu(QMenu* menu, QObject* receiver, const ch
|
||||
act->setData(QVariant((int)ViewProvider::Transform));
|
||||
}
|
||||
|
||||
if(ext && ext->getColoredElementsProperty()) {
|
||||
if(ext->getColoredElementsProperty()) {
|
||||
bool found = false;
|
||||
for(auto action : menu->actions()) {
|
||||
if(action->data().toInt() == ViewProvider::Color) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()))) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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??
|
||||
|
||||
Reference in New Issue
Block a user