Skip to content

Commit

Permalink
Check for NULL pointer
Browse files Browse the repository at this point in the history
getCurrentModelWidget can return NULL (e.g. if the user has not opened
any model yet), so check the returned value.
  • Loading branch information
sjoelund committed Nov 25, 2016
1 parent 04a3427 commit f416947
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/Modeling/MessagesWidget.cpp
Expand Up @@ -292,7 +292,7 @@ void MessagesWidget::openErrorMessageClass(QUrl url)
* and also contains the line number. If we have correct current class then no need to show root parent class i.e., P.
*/
ModelWidget *pModelWidget = MainWindow::instance()->getModelWidgetContainer()->getCurrentModelWidget();
if ((pModelWidget->getLibraryTreeItem()->getFileName().compare(pLibraryTreeItem->getFileName()) == 0) &&
if (pModelWidget /* Might be NULL */ && (pModelWidget->getLibraryTreeItem()->getFileName().compare(pLibraryTreeItem->getFileName()) == 0) &&
pModelWidget->getLibraryTreeItem()->inRange(lineNumber)) {
pLibraryTreeItem = pModelWidget->getLibraryTreeItem();
}
Expand Down

0 comments on commit f416947

Please sign in to comment.