From: Arnaud Giersch Date: Fri, 27 Sep 2019 07:17:49 +0000 (+0200) Subject: Fix warning: `content' may be used uninitialized. X-Git-Tag: v3.24~52 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/05fa4346bbe0aa0593bc8c4cbb4ed165628abc54 Fix warning: `content' may be used uninitialized. --- diff --git a/src/plugins/file_system/s4u_FileSystem.cpp b/src/plugins/file_system/s4u_FileSystem.cpp index 5eddc990c8..67e7ffd222 100644 --- a/src/plugins/file_system/s4u_FileSystem.cpp +++ b/src/plugins/file_system/s4u_FileSystem.cpp @@ -311,8 +311,8 @@ void File::move(const std::string& fullpath) int File::unlink() { /* Check if the file is on local storage */ - std::map* content; - const char* name = nullptr; + std::map* content = nullptr; + const char* name = ""; if (local_storage_) { content = local_storage_->extension()->get_content(); name = local_storage_->get_cname(); @@ -322,7 +322,7 @@ int File::unlink() name = local_disk_->get_cname(); } - if (content->find(path_) == content->end()) { + if (not content || content->find(path_) == content->end()) { XBT_WARN("File %s is not on disk %s. Impossible to unlink", path_.c_str(), name); return -1; } else {