From 02d75cd370ad4c404c8d801f747c990ef4c0a440 Mon Sep 17 00:00:00 2001 From: Andrew Nelless Date: Fri, 30 Sep 2016 15:52:24 +0100 Subject: [PATCH] #5603 Ignore exceptions in getOSInformation() --- src/gui/src/QUtility.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gui/src/QUtility.cpp b/src/gui/src/QUtility.cpp index ca2c52c0..f463f1d2 100644 --- a/src/gui/src/QUtility.cpp +++ b/src/gui/src/QUtility.cpp @@ -114,15 +114,18 @@ QString getOSInformation() QString result; #if defined(Q_OS_LINUX) - QStringList arguments; - arguments.append("/etc/os-release"); - CommandProcess cp("/bin/cat", arguments); - QString output = cp.run(); + result = "Linux"; + try { + QStringList arguments; + arguments.append("/etc/os-release"); + CommandProcess cp("/bin/cat", arguments); + QString output = cp.run(); - QRegExp resultRegex(".*PRETTY_NAME=\"([^\"]+)\".*"); - if (resultRegex.exactMatch(output)) { - QString OSInfo = resultRegex.cap(1); - result = OSInfo; + QRegExp resultRegex(".*PRETTY_NAME=\"([^\"]+)\".*"); + if (resultRegex.exactMatch(output)) { + result = resultRegex.cap(1); + } + } catch (...) { } #endif