Index: trunk/tools/czartool/CzarDb.pm
===================================================================
--- trunk/tools/czartool/CzarDb.pm	(revision 29864)
+++ trunk/tools/czartool/CzarDb.pm	(revision 29865)
@@ -719,8 +719,13 @@
 SQL
 
-    $query->execute;
+    if (!$query->execute) {return 0;}
+
     (${$pending}, ${$faults}) = $query->fetchrow_array();    
 
     ${$processed} = $self->countProcessed($label, $stage, $fromTime, $toTime);
+
+    if (!${$pending}) {${$pending} = 0;}
+    if (!${$faults}) {${$faults} = 0;}
+    if (!${$processed}) {${$processed} = 0;}
 
     return 1;
@@ -822,9 +827,10 @@
 SQL
 
-
     if (!$query->execute) {return undef;}
 
     (${$maxY}, ${$minY}, ${$maxX}, ${$minX}, ${$timeDiff}) = $query->fetchrow_array();
 
+
+    if (!${$maxY} || !${$minY} || !${$maxX} || !${$minX} || !${$timeDiff}) {return 0;}
 
     $query = $self->{_db}->prepare(<<SQL);
@@ -846,13 +852,15 @@
 
     close(GNUDAT);
-}
-
-###########################################################################
-#
-# TODO implement isLog
+
+    return 1;
+}
+
+###########################################################################
+#
+# Creates data for processing rate plots
 #
 ###########################################################################
 sub createProcessingRateData {
-    my ($self, $stage, $label, $begin, $end, $interval, $dataFile, $isLog) = @_;
+    my ($self, $stage, $label, $begin, $end, $interval, $dataFile) = @_;
 
     my $startTime = $begin;
@@ -865,5 +873,5 @@
 
     my $tmpFile = File::Temp->new( TEMPLATE => "czarplot_gnuplot_".$label."_".$stage."_r.XXXXX", DIR => '/tmp', SUFFIX => 'dat');
-    $tmpFile->unlink_on_destroy( 0 );
+    $tmpFile->unlink_on_destroy(0);
     ${$dataFile} = $tmpFile->filename;
 
@@ -873,10 +881,9 @@
     while(1) {
 
-
-        #print "NNN $startTime, $end\n";
         if (!$self->isBefore($startTime, $end)) {last;}
         $endTime = $self->addInterval($startTime, $interval);
-        $self->countProcessedPendingAndFaults($label, $stage, $startTime, $endTime, \$processed, \$pending, \$faults);
+        if (!$self->countProcessedPendingAndFaults($label, $stage, $startTime, $endTime, \$processed, \$pending, \$faults)) {}
         $timestamp = $self->getFormattedDate($endTime);
+        if (!$processed) {$processed = 0;}
         print GNUDAT "$timestamp $processed 0 0\n";
 
@@ -887,6 +894,4 @@
 
     close(GNUDAT) or print "* Problem closing gnuplot data file for rate plot for '$label' '$stage'\n";
-
-    #return $someData;
 }
 
