diff --git a/packager/media/file/file_closer.h b/packager/media/file/file_closer.h index e0d1305a8c..550c2fda5a 100644 --- a/packager/media/file/file_closer.h +++ b/packager/media/file/file_closer.h @@ -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; + } } } };