diff --git a/lib/Dist/Zilla/Dist/Builder.pm b/lib/Dist/Zilla/Dist/Builder.pm index 15078bc88..a58911b79 100644 --- a/lib/Dist/Zilla/Dist/Builder.pm +++ b/lib/Dist/Zilla/Dist/Builder.pm @@ -779,7 +779,7 @@ sub test { $self->log("all's well; removing $target"); $target->remove_tree({ safe => 0 }); - $latest->remove_tree({ safe => 0 }) if -d $latest; # error cannot unlink, is a directory + $latest->remove_tree({ safe => 0 }) if $latest && -d $latest; # error cannot unlink, is a directory $latest->remove if $latest; }