From bfcdf2270595ef39065a45341a959e388a143951 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 29 Nov 2020 16:22:09 +0000 Subject: [PATCH] TerraSync: fix crashes with null file return Not sure how this is happening, but, check for a null file object in FileGetRequest::onDone. --- simgear/io/HTTPRepository.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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);