Code

Fix crash when GIT_DIR is invalid
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Fri, 4 Aug 2006 15:46:19 +0000 (17:46 +0200)
committerJunio C Hamano <junkio@cox.net>
Fri, 4 Aug 2006 18:30:19 +0000 (11:30 -0700)
We used to test if a pointer was NULL, and if it was, try to access it.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
setup.c

diff --git a/setup.c b/setup.c
index 358e139d84c422a9bd0a9500807a31cbf7695f02..2afdba414a073705440f887593a1b5daa1023758 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -184,7 +184,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
                }
                return NULL;
        bad_dir_environ:
-               if (!nongit_ok) {
+               if (nongit_ok) {
                        *nongit_ok = 1;
                        return NULL;
                }