Skip to content

Commit 6ffabb8

Browse files
Silence unused result warnings for QFile::open
1 parent 47a4e34 commit 6ffabb8

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/lib/fex/lexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ namespace fex
164164
// Note: Using QFile instead of ifstream to handle encoding differences between platforms
165165
// (specifically to handle accented characters on Windows)
166166
QFile file(path);
167-
file.open(QIODevice::ReadOnly);
167+
if (!file.open(QIODevice::ReadOnly)) return Lex();
168168

169169
const QByteArray data = file.readAll();
170170

src/log.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void logInit() {
189189
dir.mkpath(settingsPath);
190190
Log::path = dir.absoluteFilePath(QStringLiteral("porymap.log"));
191191
Log::file.setFileName(Log::path);
192-
Log::file.open(QIODevice::WriteOnly | QIODevice::Append);
192+
if (!Log::file.open(QIODevice::WriteOnly | QIODevice::Append)) return;
193193
Log::textStream.setDevice(&Log::file);
194194

195195
QObject::connect(&Log::displayClearTimer, &QTimer::timeout, [=] {

src/mainwindow.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,9 @@ void MainWindow::restoreWindowState() {
708708
}
709709

710710
void MainWindow::setTheme(QString theme) {
711-
QFile File(QString(":/themes/%1.qss").arg(theme));
712-
File.open(QFile::ReadOnly);
713-
QString stylesheet = QLatin1String(File.readAll());
711+
QFile file(QString(":/themes/%1.qss").arg(theme));
712+
if (!file.open(QFile::ReadOnly)) return;
713+
QString stylesheet = QLatin1String(file.readAll());
714714

715715
stylesheet.append(QString("QWidget { %1 } ").arg(Util::toStylesheetString(porymapConfig.applicationFont)));
716716
stylesheet.append(QString("MapTree { %1 } ").arg(Util::toStylesheetString(porymapConfig.mapListFont)));

0 commit comments

Comments
 (0)