Skip to content

Commit

Permalink
difftool: silence uninitialized variable warning
Browse files Browse the repository at this point in the history
Git::config() returns `undef` when given keys that do not exist.
Check that the $guitool value is defined to prevent a noisy
"Use of uninitialized variable $guitool in length" warning.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
davvid authored and gitster committed Feb 17, 2013
1 parent 7b6e784 commit af14b5c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git-difftool.perl
Expand Up @@ -336,7 +336,7 @@ sub main
} }
if ($opts{gui}) { if ($opts{gui}) {
my $guitool = Git::config('diff.guitool'); my $guitool = Git::config('diff.guitool');
if (length($guitool) > 0) { if (defined($guitool) && length($guitool) > 0) {
$ENV{GIT_DIFF_TOOL} = $guitool; $ENV{GIT_DIFF_TOOL} = $guitool;
} }
} }
Expand Down

0 comments on commit af14b5c

Please sign in to comment.