From 88ffadb70e3803d280f2d43ea176cb9e23dac7ed Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Mon, 8 Feb 2010 11:46:39 +0000 Subject: [PATCH] * hydra: handle case where logfile is empty --- src/lib/Hydra/Controller/Build.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index dc7be077..b075458f 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -45,10 +45,10 @@ 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; - $c->stash->{logtext} = `tail -n 50 $path`; - } + 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`; + } }