diff --git a/simgear/io/HTTPRepository.cxx b/simgear/io/HTTPRepository.cxx index d7db9539..18ac85d0 100644 --- a/simgear/io/HTTPRepository.cxx +++ b/simgear/io/HTTPRepository.cxx @@ -994,7 +994,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);