diff --git a/src/lib/utils/HTTPStream.cpp b/src/lib/utils/HTTPStream.cpp index 5db83356e..742136464 100755 --- a/src/lib/utils/HTTPStream.cpp +++ b/src/lib/utils/HTTPStream.cpp @@ -72,8 +72,9 @@ bool download_file_if_newer(const string& host, const string& path, const string tm modtm = boost::initialized_value; const char* rfc_1123_fmt = "%a, %d %b %Y %H:%M:%S %Z"; time_t modified = 0; - if (download.good()) { - stringstream ss(download.headers().at("Last-Modified")); + const std::string last_modified_key = "Last-Modified"; + if (download.good() && download.headers().find(last_modified_key) != download.headers().end()) { + stringstream ss(download.headers().at(last_modified_key)); ss >> std::get_time(&modtm, rfc_1123_fmt); modified = mktime(&modtm); }