Skip to content

Commit

Permalink
Coverity issues: check return value of dynamic_cast or replace it wit…
Browse files Browse the repository at this point in the history
…h static_cast
  • Loading branch information
wwmayer committed Aug 17, 2016
1 parent 3dd3461 commit e4f0dda
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 92 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Sketcher/Gui/CommandConstraints.cpp
Expand Up @@ -1659,7 +1659,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg)
const std::vector<std::string> &SubNames = selection[0].getSubNames();
Sketcher::SketchObject* Obj = dynamic_cast<Sketcher::SketchObject*>(selection[0].getObject());

if (SubNames.size() != 2 && SubNames.size() != 3) {
if (!Obj || (SubNames.size() != 2 && SubNames.size() != 3)) {
strError = QObject::tr("Wrong number of selected objects!","perpendicular constraint");
if (!strError.isEmpty()) strError.append(QString::fromLatin1("\n\n"));
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Sketcher/Gui/TaskSketcherElements.cpp
Expand Up @@ -562,7 +562,7 @@ void TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(void)
void TaskSketcherElements::on_listWidgetElements_itemEntered(QListWidgetItem *item)
{
ElementItem *it = dynamic_cast<ElementItem*>(item);
if (!item) return;
if (!it) return;

Gui::Selection().rmvPreselect();

Expand Down

0 comments on commit e4f0dda

Please sign in to comment.