Fix a possible crash if a file fails to be closed
Change-Id: I6bc806a68b81ea5bde09bada1175f257c296afcd
This commit is contained in:
parent
29e14a3d6b
commit
d60cc9416f
|
@ -17,9 +17,12 @@ namespace media {
|
||||||
/// scope.
|
/// scope.
|
||||||
struct FileCloser {
|
struct FileCloser {
|
||||||
inline void operator()(File* file) const {
|
inline void operator()(File* file) const {
|
||||||
if (file != NULL && !file->Close()) {
|
if (file != NULL) {
|
||||||
LOG(WARNING) << "Failed to close the file properly: "
|
const std::string filename = file->file_name();
|
||||||
<< file->file_name();
|
if (!file->Close()) {
|
||||||
|
LOG(WARNING) << "Failed to close the file properly: "
|
||||||
|
<< filename;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue