* hydra: handle case where logfile is empty

This commit is contained in:
Rob Vermaas 2010-02-08 11:46:39 +00:00
parent b6ad5c3103
commit 88ffadb70e

View file

@ -45,8 +45,8 @@ sub view_build : Chained('build') PathPart('') Args(0) {
}
(my $lastBuildStep) = $build->buildsteps->search({},{order_by => "stepnr DESC", rows => 1});
if (defined $build->resultInfo && $build->resultInfo->buildstatus == 1 && $lastBuildStep && isValidPath($lastBuildStep->logfile)) {
my $path = $lastBuildStep->logfile;
my $path = defined $lastBuildStep ? $lastBuildStep->logfile : "" ;
if (defined $build->resultInfo && $build->resultInfo->buildstatus == 1 && !($path eq "") && isValidPath($lastBuildStep->logfile)) {
$c->stash->{logtext} = `tail -n 50 $path`;
}