diff --git a/simgear/io/HTTPRepository.cxx b/simgear/io/HTTPRepository.cxx index 8a21c4ea..5d57f1c7 100644 --- a/simgear/io/HTTPRepository.cxx +++ b/simgear/io/HTTPRepository.cxx @@ -995,7 +995,10 @@ HTTPRepository::failure() const } void onDone() override { - file->close(); + if (file) { + file->close(); + } + if (responseCode() == 200) { std::string hash = strutils::encodeHex(sha1_result(&hashContext), HASH_LENGTH);