fix a segfault in got_ref_open()
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;
}
}