diff: fix a possible null pointer dereference

The condition in the ternary operator was wrong, hence the wrong char pointer could be used as the parameter for show_submodule_summary. one->path may be null, but we definitely need a non null path given to the function. Signed-off-by: Stefan Beller <stefanbeller@googlemail.com> Acked-By: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Aug 9, 2013 at 00:11 UTC 3b0c18af5c545c93bf33b53d467b887e9733c0c6
1 file changed +1 -1
diff.c
+1 -1
@@ -2252,7 +2252,7 @@ static void builtin_diff(const char *name_a,
2252 (!two->mode || S_ISGITLINK(two->mode))) {
2253 const char *del = diff_get_color_opt(o, DIFF_FILE_OLD);
2254 const char *add = diff_get_color_opt(o, DIFF_FILE_NEW);
2255 - show_submodule_summary(o->file, one ? one->path : two->path,
2255 + show_submodule_summary(o->file, one->path ? one->path : two->path,
2256 line_prefix,
2257 one->sha1, two->sha1, two->dirty_submodule,
2258 meta, del, add, reset);