diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 57b29de7a..e8cf42774 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -237,6 +237,7 @@ Nico Seessle
Nigel Magnay
Oliver Merkel
Oliver Rossmueller
+Omer Shapira
Oystein Gisnas
Patrick C. Beard
Patrick Chanezon
diff --git a/WHATSNEW b/WHATSNEW
index eb329c799..66ebadf46 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -64,6 +64,10 @@ Fixed bugs:
* email : IO error sending mail with plain mimetype
Bug 48932
+ * the complete-ant-cmd.pl script failed to create a proper cache of
+ target if "ant -p" failed.
+ Bugzilla Report 48980
+
Other changes:
--------------
diff --git a/contributors.xml b/contributors.xml
index 57adce3a0..f16c3fdba 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -973,6 +973,10 @@
Oliver
Rossmueller
+
+ Omer
+ Shapira
+
Øystein
Gisnås
diff --git a/src/script/complete-ant-cmd.pl b/src/script/complete-ant-cmd.pl
index b58c26e15..37891241b 100644
--- a/src/script/complete-ant-cmd.pl
+++ b/src/script/complete-ant-cmd.pl
@@ -83,7 +83,7 @@ sub getTargets {
# cache-file.
my $cacheFile = $buildFile;
$cacheFile =~ s|(.*/)?(.*)|${1}.ant-targets-${2}|;
- if ((!-e $cacheFile) || (-M $buildFile) < (-M $cacheFile)) {
+ if ((!-e $cacheFile) || (-z $cacheFile) || (-M $buildFile) < (-M $cacheFile)) {
open( CACHE, '>'.$cacheFile ) || die "can\'t write $cacheFile: $!\n";
open( HELP, "$antCmd -projecthelp -f '$buildFile'|" ) || return();
my %targets;