diff --git a/swh/indexer/origin_head.py b/swh/indexer/origin_head.py --- a/swh/indexer/origin_head.py +++ b/swh/indexer/origin_head.py @@ -30,6 +30,8 @@ def index(self, origin): origin_id = origin['id'] latest_snapshot = self.storage.snapshot_get_latest(origin_id) + if latest_snapshot is None: + return None method = getattr(self, '_try_get_%s_head' % origin['type'], None) if method is None: method = self._try_get_head_generic @@ -111,8 +113,7 @@ def _try_get_head_generic(self, snapshot): # Works on 'deposit', 'svn', and 'pypi'. try: - if isinstance(snapshot, dict): - branches = snapshot['branches'] + branches = snapshot['branches'] except KeyError: return None else: