Skip to content

Commit bc5d287

Browse files
committed
cleanup
1 parent 836b428 commit bc5d287

1 file changed

Lines changed: 3 additions & 17 deletions

File tree

gui/resultstree.cpp

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -762,27 +762,13 @@ void ResultsTree::startApplication(const ResultItem *target, int application)
762762
}
763763

764764
if (target && application >= 0 && application < mApplications->getApplicationCount() && target->parent()) {
765-
// Make sure we are working with the first column
766-
if (target->column() != 0)
767-
target = dynamic_cast<ResultItem*>(target->parent()->child(target->row(), 0));
768-
769-
if (!target || !target->errorItem) {
770-
QMessageBox msg(QMessageBox::Critical,
771-
tr("Cppcheck"),
772-
tr("Internal error in %1, failed to find ErrorPathItem").arg(__FUNCTION__),
773-
QMessageBox::Ok,
774-
this);
775-
msg.exec();
776-
return;
777-
}
778-
779-
const auto errorPathItem = target->getErrorPathItem();
765+
const auto& errorPathItem = target->getErrorPathItem();
780766

781767
//Replace (file) with filename
782768
QString file = QDir::toNativeSeparators(errorPathItem.file);
783769
qDebug() << "Opening file: " << file;
784770

785-
QFileInfo info(file);
771+
const QFileInfo info(file);
786772
if (!info.exists()) {
787773
if (info.isAbsolute()) {
788774
QMessageBox msgbox(this);
@@ -811,7 +797,7 @@ void ResultsTree::startApplication(const ResultItem *target, int application)
811797
QString params = app.getParameters();
812798
params.replace("(file)", file, Qt::CaseInsensitive);
813799

814-
params.replace("(line)", QString("%1").arg(errorPathItem.line), Qt::CaseInsensitive);
800+
params.replace("(line)", QString::number(errorPathItem.line), Qt::CaseInsensitive);
815801

816802
params.replace("(message)", target->errorItem->message, Qt::CaseInsensitive);
817803
params.replace("(severity)", severityToTranslatedString(target->errorItem->severity), Qt::CaseInsensitive);

0 commit comments

Comments
 (0)