Skip to content

Commit

Permalink
Don't crash on empty cmdline
Browse files Browse the repository at this point in the history
Relates-To: #224
  • Loading branch information
milianw committed May 15, 2020
1 parent a542871 commit fa33bd8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/parsers/perf/perfparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,11 +1092,15 @@ class PerfParserPrivate : public QObject

void setFeatures(const FeaturesDefinition& features)
{
// first entry in cmdline is "perf" which could contain a path
// we only want to show the name without the path
auto args = features.cmdline;
args.removeFirst();
summaryResult.command = QLatin1String("perf ") + QString::fromUtf8(args.join(' '));
if (features.cmdline.isEmpty()) {
summaryResult.command = QStringLiteral("??");
} else {
// first entry in cmdline is "perf" which could contain a path
// we only want to show the name without the path
auto args = features.cmdline;
args.removeFirst();
summaryResult.command = QLatin1String("perf ") + QString::fromUtf8(args.join(' '));
}
summaryResult.hostName = QString::fromUtf8(features.hostName);
summaryResult.linuxKernelVersion = QString::fromUtf8(features.osRelease);
summaryResult.perfVersion = QString::fromUtf8(features.version);
Expand Down

0 comments on commit fa33bd8

Please sign in to comment.