Skip to content

Commit

Permalink
+ fixes #2116: FreeCAD crash when I click on treeview
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jun 9, 2015
1 parent 54317be commit 4f5534a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Gui/propertyeditor/PropertyItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1706,14 +1706,12 @@ QVariant PropertyEnumItem::value(const App::Property* prop) const
assert(prop && prop->getTypeId().isDerivedFrom(App::PropertyEnumeration::getClassTypeId()));

const App::PropertyEnumeration* prop_enum = static_cast<const App::PropertyEnumeration*>(prop);
if (prop_enum->getEnums() == 0) {
const std::vector<std::string>& value = prop_enum->getEnumVector();
long currentItem = prop_enum->getValue();

if (currentItem < 0 || currentItem >= value.size())
return QVariant(QString());
}
else {
const std::vector<std::string>& value = prop_enum->getEnumVector();
long currentItem = prop_enum->getValue();
return QVariant(QString::fromUtf8(value[currentItem].c_str()));
}
return QVariant(QString::fromUtf8(value[currentItem].c_str()));
}

void PropertyEnumItem::setValue(const QVariant& value)
Expand Down

0 comments on commit 4f5534a

Please sign in to comment.