Fix builtin checkout crashing when given an invalid path
authorAlex Riesen <raa.lkml@gmail.com>
Thu, 28 Feb 2008 16:30:47 +0000 (17:30 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 Feb 2008 08:00:29 +0000 (00:00 -0800)
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-checkout.c

index 4a4bb8b77dc9251849a2ecf625a4efb9ce154fdb..9579ff4ab12dfc1c48d6e530a93d0d18e07c2ebb 100644 (file)
@@ -545,6 +545,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 
        if (argc) {
                const char **pathspec = get_pathspec(prefix, argv);
+
+               if (!pathspec)
+                       die("invalid path specification");
+
                /* Checkout paths */
                if (opts.new_branch || opts.force || opts.merge) {
                        if (argc == 1) {