Browse files

difftool: silence uninitialized variable warning

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...
1 parent 7b6e784 commit af14b5cf1bec831f90fb5d4136e0205de802b01b @davvid davvid committed with gitster Feb 15, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 git-difftool.perl
View
2 git-difftool.perl
@@ -336,7 +336,7 @@ sub main
}
if ($opts{gui}) {
my $guitool = Git::config('diff.guitool');
- if (length($guitool) > 0) {
+ if (defined($guitool) && length($guitool) > 0) {
$ENV{GIT_DIFF_TOOL} = $guitool;
}
}

0 comments on commit af14b5c

Please sign in to comment.