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

@@ -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))

View File

@@ -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());

View File

@@ -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) {