From 4a26ac58d0c9e465dc98b4d84aebd734ca073a55 Mon Sep 17 00:00:00 2001 From: Alessandro Date: Tue, 19 May 2020 14:50:26 +0200 Subject: [PATCH] Fix #23 Revert a bug introduced with ab32fbbf984c0edc6de1c4e26a2d3846f662cfee Crash if checking for updates without an internet connection --- CHANGELOG.md | 2 +- src/versioncontroller.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de1e788..2fbbe8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm The first release is [3.0.0] because this is actually the third major version (completely rewritten) of the software. ## [Unreleased] -... +- Fixed crash on startup or if checking for updates without an internet connection ([#23](https://github.com/AresValley/Artemis/pull/23)) ## [3.2.1] - 2020-04-25 ### Added diff --git a/src/versioncontroller.py b/src/versioncontroller.py index 3878f3f..105677b 100644 --- a/src/versioncontroller.py +++ b/src/versioncontroller.py @@ -77,9 +77,14 @@ def _download_versions_file(): } } """ - return json.load( - BytesIO(download_file(Constants.VERSION_LINK)) - ).get(get_os(), None) + try: + version_dict = json.load( + BytesIO(download_file(Constants.VERSION_LINK)) + )[get_os()] + except Exception: + return None + else: + return version_dict class VersionController: