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.
|
||||
struct FileCloser {
|
||||
inline void operator()(File* file) const {
|
||||
if (file != NULL && !file->Close()) {
|
||||
LOG(WARNING) << "Failed to close the file properly: "
|
||||
<< file->file_name();
|
||||
if (file != NULL) {
|
||||
const std::string filename = file->file_name();
|
||||
if (!file->Close()) {
|
||||
LOG(WARNING) << "Failed to close the file properly: "
|
||||
<< filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue