This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

#5603 Ignore exceptions in getOSInformation()

  • Loading branch information...
nlyan committed Sep 30, 2016
1 parent 088ac82 commit 02d75cd370ad4c404c8d801f747c990ef4c0a440
Showing with 12 additions and 9 deletions.
  1. +12 −9 src/gui/src/QUtility.cpp
View
@@ -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();
-
- QRegExp resultRegex(".*PRETTY_NAME=\"([^\"]+)\".*");
- if (resultRegex.exactMatch(output)) {
- QString OSInfo = resultRegex.cap(1);
- result = OSInfo;
+ 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)) {
+ result = resultRegex.cap(1);
+ }
+ } catch (...) {
}
#endif

0 comments on commit 02d75cd

Please sign in to comment.