Commit 6e472abb219118bbb338c67086cf830c57de2c85

Stefan Sperling 2019-05-13T17:27:39

fix a segfault in got_ref_open()

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/reference.c b/lib/reference.c
index 02c770e..1ddd447 100644
--- a/lib/reference.c
+++ b/lib/reference.c
@@ -475,7 +475,7 @@ got_ref_open(struct got_reference **ref, struct got_repository *repo,
 					err = got_error_from_errno("fclose");
 					got_ref_close(*ref);
 					*ref = NULL;
-				} else
+				} else if (*ref)
 					(*ref)->lf = lf;
 			}
 		}