From 2939e0a6895cbef9af1697d468cd6b50e9162f3f Mon Sep 17 00:00:00 2001 From: Dario <medariox@users.noreply.github.com> Date: Wed, 16 Dec 2020 14:57:23 +0100 Subject: [PATCH] Fix startup with git install without valid git (#8884) --- medusa/__main__.py | 2 +- medusa/updater/github_updater.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/medusa/__main__.py b/medusa/__main__.py index f456ade1a5..cb0812aabc 100755 --- a/medusa/__main__.py +++ b/medusa/__main__.py @@ -1045,7 +1045,7 @@ def initialize(self, console_logging=True): if app.VERSION_NOTIFY: updater = CheckVersion().updater - if updater: + if updater and updater.current_version: app.APP_VERSION = updater.current_version # initialize the static NZB and TORRENT providers diff --git a/medusa/updater/github_updater.py b/medusa/updater/github_updater.py index 75a8f97793..2e05701feb 100644 --- a/medusa/updater/github_updater.py +++ b/medusa/updater/github_updater.py @@ -51,14 +51,16 @@ def current_version(self): self.update_commit_hash() cur_version = self._run_git(self._git_path, 'describe --tags --abbrev=0 {0}'.format( self._cur_commit_hash))[0] - return cur_version.lstrip('v') + if cur_version: + return cur_version.lstrip('v') @property def newest_version(self): self.update_newest_commit_hash() new_version = self._run_git(self._git_path, 'describe --tags --abbrev=0 {0}'.format( self._newest_commit_hash))[0] - return new_version.lstrip('v') + if new_version: + return new_version.lstrip('v') @property def commits_behind(self): @@ -379,8 +381,7 @@ def list_remote_branches(self): branches, _, exit_status = self._run_git(self._git_path, 'ls-remote --heads {0}'.format(app.GIT_REMOTE)) if exit_status == 0 and branches: - if branches: - return re.findall(r'refs/heads/(.*)', branches) + return re.findall(r'refs/heads/(.*)', branches) return [] def update_remote_origin(self):