From a7435ae7852aff8c9d60da7740b7b66a997c8d50 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 7 Jan 2019 14:36:50 +0100 Subject: [PATCH] PerfProfiler: Handle failure to read trace point script file We can just write an error message into the text edit in that case. Change-Id: I9ab0ab226bd8f171ab1a693884053a8c759cec2b Reviewed-by: Christian Kandeler --- src/plugins/perfprofiler/perftracepointdialog.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/perfprofiler/perftracepointdialog.cpp b/src/plugins/perfprofiler/perftracepointdialog.cpp index 76a2428427d..b821924f832 100644 --- a/src/plugins/perfprofiler/perftracepointdialog.cpp +++ b/src/plugins/perfprofiler/perftracepointdialog.cpp @@ -59,8 +59,12 @@ PerfTracePointDialog::PerfTracePointDialog() : QTC_ASSERT(m_device, return); QFile file(":/perfprofiler/tracepoints.sh"); - file.open(QIODevice::ReadOnly); - m_ui->textEdit->setPlainText(QString::fromUtf8(file.readAll())); + if (file.open(QIODevice::ReadOnly)) { + m_ui->textEdit->setPlainText(QString::fromUtf8(file.readAll())); + } else { + m_ui->textEdit->setPlainText(tr("Error: Failed to load trace point script %1: %2.") + .arg(file.fileName()).arg(file.errorString())); + } m_ui->privilegesChooser->setCurrentText(m_device->type() == Constants::DESKTOP_DEVICE_TYPE ? QLatin1String("pkexec") : QLatin1String("n.a."));