git: put NULL check at the top
diff --git a/src/transports/git.c b/src/transports/git.c
index 3e7e5a0..6c6acf9 100644
--- a/src/transports/git.c
+++ b/src/transports/git.c
@@ -130,12 +130,15 @@ static int git_proto_stream_write(
static void git_proto_stream_free(git_smart_subtransport_stream *stream)
{
- git_proto_stream *s = (git_proto_stream *)stream;
- git_subtransport *t = OWNING_SUBTRANSPORT(s);
+ git_proto_stream *s;
+ git_subtransport *t;
if (!stream)
return;
+ s = (git_proto_stream *)stream;
+ t = OWNING_SUBTRANSPORT(s);
+
t->current_stream = NULL;
git_stream_close(s->io);