aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hex.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hex.c b/hex.c
index e7af18fe55..74d256f239 100644
--- a/hex.c
+++ b/hex.c
@@ -124,6 +124,13 @@ char *hash_to_hex_algop_r(char *buffer, const unsigned char *hash,
char *buf = buffer;
int i;
+ /*
+ * Our struct object_id has been memset to 0, so default to printing
+ * using the default hash.
+ */
+ if (algop == &hash_algos[0])
+ algop = the_hash_algo;
+
for (i = 0; i < algop->rawsz; i++) {
unsigned int val = *hash++;
*buf++ = hex[val >> 4];