clar helper: don't dereference giterr_last() if it's NULL It can cause segfaults if the call didn't set an error
diff --git a/tests-clar/clar_libgit2.h b/tests-clar/clar_libgit2.h
index 63bc703..d250494 100644
--- a/tests-clar/clar_libgit2.h
+++ b/tests-clar/clar_libgit2.h
@@ -15,7 +15,7 @@
#define cl_git_pass(expr) do { \
giterr_clear(); \
if ((expr) != 0) \
- clar__assert(0, __FILE__, __LINE__, "Function call failed: " #expr, giterr_last()->message, 1); \
+ clar__assert(0, __FILE__, __LINE__, "Function call failed: " #expr, giterr_last() ? giterr_last()->message : NULL, 1); \
} while(0)
/**