Skip to content

Commit

Permalink
Check for the index out of bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed May 16, 2019
1 parent 2f2c995 commit 555414b
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions OMEdit/OMEdit/OMEditGUI/Modeling/ModelWidgetContainer.cpp
Expand Up @@ -5732,13 +5732,10 @@ void ModelWidget::drawModelIconComponents()
if (!pLibraryTreeItem->isNonExisting() && !pLibraryTreeItem->getModelWidget()) {
pLibraryTreeModel->showModelWidget(pLibraryTreeItem, false);
}
QString annotation;
if (mComponentsAnnotationsList.size() >= i) {
annotation = mComponentsAnnotationsList.at(i);
if (StringHandler::getPlacementAnnotation(annotation).isEmpty()) {
annotation = StringHandler::removeFirstLastCurlBrackets(annotation);
annotation = QString("{%1, Placement(false,0.0,0.0,-10.0,-10.0,10.0,10.0,0.0,-,-,-,-,-,-,)}").arg(annotation);
}
QString annotation = mComponentsAnnotationsList.size() > i ? mComponentsAnnotationsList.at(i) : "";
if (StringHandler::getPlacementAnnotation(annotation).isEmpty()) {
annotation = StringHandler::removeFirstLastCurlBrackets(annotation);
annotation = QString("{%1, Placement(false,0.0,0.0,-10.0,-10.0,10.0,10.0,0.0,-,-,-,-,-,-,)}").arg(annotation);
}
mpIconGraphicsView->addComponentToView(pComponentInfo->getName(), pLibraryTreeItem, annotation, QPointF(0, 0), pComponentInfo,
false, true);
Expand Down Expand Up @@ -5773,13 +5770,10 @@ void ModelWidget::drawModelDiagramComponents()
pLibraryTreeModel->showModelWidget(pLibraryTreeItem, false);
}
}
QString annotation;
if (mComponentsAnnotationsList.size() >= i) {
annotation = mComponentsAnnotationsList.at(i);
if (StringHandler::getPlacementAnnotation(annotation).isEmpty()) {
annotation = StringHandler::removeFirstLastCurlBrackets(annotation);
annotation = QString("{%1, Placement(false,0.0,0.0,-10.0,-10.0,10.0,10.0,0.0,-,-,-,-,-,-,)}").arg(annotation);
}
QString annotation = mComponentsAnnotationsList.size() > i ? mComponentsAnnotationsList.at(i) : "";
if (StringHandler::getPlacementAnnotation(annotation).isEmpty()) {
annotation = StringHandler::removeFirstLastCurlBrackets(annotation);
annotation = QString("{%1, Placement(false,0.0,0.0,-10.0,-10.0,10.0,10.0,0.0,-,-,-,-,-,-,)}").arg(annotation);
}
mpDiagramGraphicsView->addComponentToView(pComponentInfo->getName(), pLibraryTreeItem, annotation, QPointF(0, 0), pComponentInfo,
false, true);
Expand Down

0 comments on commit 555414b

Please sign in to comment.