Procházet zdrojové kódy

Check QFile::open() return value

Otherwise, QFile::readAll() will print annoying log messages about
failure. Can be avoided.
Vincent Lang před 8 roky
rodič
revize
8b8b1f5ffa
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  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