https://bugs.kde.org/show_bug.cgi?id=486951

--- Comment #2 from Yaroslav Sidlovsky <zawer...@gmail.com> ---
After some debugging it turns out that crash happens because return value from
function `git_tag_lookup` is ignored it is non zero.

I'm talking about this line of code:
https://invent.kde.org/sdk/kommit/-/blob/5954f99cf5e5db96c13a73fd1752e4ad2211fa1e/src/libkommit/gitmanager.cpp?page=2#L1266

Proposed patch:
```
diff --git a/src/libkommit/gitmanager.cpp b/src/libkommit/gitmanager.cpp
index c1b4244..8f8ce9f 100644
--- a/src/libkommit/gitmanager.cpp
+++ b/src/libkommit/gitmanager.cpp
@@ -1241,7 +1241,14 @@ void Manager::forEachTags(std::function<void(Tag *)> cb)
         Q_UNUSED(name)
         auto w = reinterpret_cast<wrapper *>(payload);
         git_tag *t;
-        git_tag_lookup(&t, w->repo, oid_c);
+        int ret = git_tag_lookup(&t, w->repo, oid_c);
+        if (ret) {
+            const auto err = git_error_last();
+            if (err) {
+                qWarning().noquote().nospace() << "libgit2 error: " <<
err->message;
+            }
+            return 0;
+        }

         if (!t)
             return 0;
```

Macros PRINT_ERROR won't work here.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to