Explorar el Código

Check QFile::open() return value

Otherwise, QFile::readAll() will print annoying log messages about
failure. Can be avoided.
Vincent Lang hace 8 años
padre
commit
8b8b1f5ffa
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  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