From b68135d3a4cd1fdd40ddf2a11d81a5a84f7e75ba Mon Sep 17 00:00:00 2001 From: Abdelilah El Aissaoui Date: Mon, 11 Apr 2022 04:27:25 +0200 Subject: [PATCH] Fixed crash when creating the graph if the repo contains tags that point to blobs --- src/main/kotlin/app/git/graph/GraphWalk.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/app/git/graph/GraphWalk.kt b/src/main/kotlin/app/git/graph/GraphWalk.kt index cf4dc6c..a72eac4 100644 --- a/src/main/kotlin/app/git/graph/GraphWalk.kt +++ b/src/main/kotlin/app/git/graph/GraphWalk.kt @@ -117,8 +117,12 @@ class GraphWalk(private var repository: Repository?) : RevWalk(repository) { is RevCommit -> markStart(refTarget) // RevTag case handles commits without branches but only tags. is RevTag -> { - val commit = lookupCommit(refTarget.`object`) - markStart(commit) + if(refTarget.`object` is RevCommit) { + val commit = lookupCommit(refTarget.`object`) + markStart(commit) + } else { + println("Tag ${refTarget.tagName} is pointing to ${refTarget.`object`::class.simpleName}") + } } } } catch (e: MissingObjectException) {