Browse Source

Check QFile::open() return value

Otherwise, QFile::readAll() will print annoying log messages about
failure. Can be avoided.
Vincent Lang 8 years ago
parent
commit
8b8b1f5ffa
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/player/CodecsComponent.cpp

+ 2 - 1
src/player/CodecsComponent.cpp

@@ -264,7 +264,8 @@ static bool useSystemVideoDecoders()
 static QString loadDeviceID(QString filename)
 {
   QFile path(filename);
-  path.open(QFile::ReadOnly);
+  if (!path.open(QFile::ReadOnly))
+    return "";
   auto res = QString::fromLatin1(path.readAll());
   if (res.size() < 32 || res.size() > 512)
     res = ""; // mark as invalid