Subject: | undef values in charts lead to errors while drawing accent lines |
I got the ppm distribution 1.35, but the code in area.pm is identical to the current version 1.43!
When plotting area graphs with some undef values in the data I experienced errors like these:
[Tue Oct 21 08:48:03 2003] (eval 224): Use of uninitialized value in subroutine entry at c:/Perl/site/lib/GD/Graph/area.pm line 105.
Looking more closely at the code in area.pm I find
97 my $value = $values[$i];
98 ## XXX Why don't I need this line?
99 ## next unless defined $value;
100
101 my ($x, $y) = $poly->getPt($i);
102 my $bottom = $bottom[$i]->[1];
103
104 $self->{graph}->dashedLine($x, $y, $x, $bottom, $brci);
By adding the following line right before the dashedLine call
--> next unless (defined $x) and (defined $y) and (defined $bottom);
I can prevent these errors to occur!!
So, this should be easy to fix - you try to call dashedLine with undef values and that causes the problem!