[svn:p5ee] r8800 - p5ee/trunk/App-Widget/lib/App/Widget

[email protected]
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
Author: spadkins
Date: Mon Feb  5 12:52:08 2007
New Revision: 8800

Modified:
   p5ee/trunk/App-Widget/lib/App/Widget/Graph.pm

Log:
Replace undef with 0 for ->{y}. Segmentation fault was occuring.

Modified: p5ee/trunk/App-Widget/lib/App/Widget/Graph.pm
==============================================================================
--- p5ee/trunk/App-Widget/lib/App/Widget/Graph.pm	(original)
+++ p5ee/trunk/App-Widget/lib/App/Widget/Graph.pm	Mon Feb  5 12:52:08 2007
@@ -220,7 +220,7 @@
         #print STDERR " row {", join("|", %{$objects->[0]}), "]\n";
     }
 
-    my (@x, @yn, $object, $column);
+    my (@x, @yn, $object, $column, $x, $yn);
     my ($label);
 
     my $data_dims   = ($#$keys + 1) + $column_dims;
@@ -232,6 +232,15 @@
                 $yn[$j][$i] = $object->{$column};
             }
         }
+
+        for ($yn = 0; $yn <= $#yn; $yn ++) {
+            for ($x = 0; $x <= $#x; $x ++) {
+                if (! defined $yn[$yn][$x]) {
+                    $yn[$yn][$x] = 0;
+                }
+            }
+        }
+
         $spec->{y} = \@yn;
 
         if ($column_dims) {
@@ -269,6 +278,7 @@
         $label =~ s/<br>//g;
         $spec->{x_title} = $label if (!$spec->{x_title});
         my (@x, %x_idx, $x_value, @y, %y_idx, $y_value);
+
         foreach my $object (@$objects) {
             $x_value = $object->{$x_column};
             $y_value = $object->{$y_column};
@@ -282,11 +292,21 @@
             }
             $yn[$y_idx{$y_value}][$x_idx{$x_value}] = $object->{$column};
         }
+
+        for ($yn = 0; $yn <= $#yn; $yn ++) {
+            for ($x = 0; $x <= $#x; $x ++) {
+                if (! defined $yn[$yn][$x]) {
+                    $yn[$yn][$x] = 0;
+                }
+            }
+        }
+
         $spec->{x} = \@x;
         $spec->{y} = \@yn;
 
         $spec->{y_labels} = \@y;
     }
+
     &App::sub_exit() if ($App::trace);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.