mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix potential null deref
This commit is contained in:
parent
530b997d7e
commit
4cdcfe6dd3
|
@ -138,7 +138,14 @@ bool extractMatchingFile(VDir* dir, std::function<QString (VDirEntry*)> filter)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
VFile* outfile = VFileOpen(target.toUtf8().constData(), O_WRONLY | O_TRUNC | O_CREAT);
|
VFile* outfile = VFileOpen(target.toUtf8().constData(), O_WRONLY | O_TRUNC | O_CREAT);
|
||||||
|
if (!outfile) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
VFile* infile = dir->openFile(dir, entry->name(entry), O_RDONLY);
|
VFile* infile = dir->openFile(dir, entry->name(entry), O_RDONLY);
|
||||||
|
if (!infile) {
|
||||||
|
outfile->close(outfile);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
VFileDevice::copyFile(infile, outfile);
|
VFileDevice::copyFile(infile, outfile);
|
||||||
infile->close(infile);
|
infile->close(infile);
|
||||||
outfile->close(outfile);
|
outfile->close(outfile);
|
||||||
|
|
Loading…
Reference in New Issue