]> source.dussan.org Git - poi.git/commitdiff
Fixed ArrayPtg.toString to not crash when partially initialised
authorJosh Micich <josh@apache.org>
Wed, 3 Sep 2008 17:03:02 +0000 (17:03 +0000)
committerJosh Micich <josh@apache.org>
Wed, 3 Sep 2008 17:03:02 +0000 (17:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@691687 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/record/formula/ArrayPtg.java

index f2e836ffcc7454fcf3af268e0817f67ace8b2dca..9020c16342a6aac8d9d9e454de73209cbb2121ba 100644 (file)
@@ -94,10 +94,14 @@ public final class ArrayPtg extends Ptg {
 
                buffer.append("columns = ").append(getColumnCount()).append("\n");
                buffer.append("rows = ").append(getRowCount()).append("\n");
-               for (int x=0;x<getColumnCount();x++) {
-                       for (int y=0;y<getRowCount();y++) {
-                               Object o = token_3_arrayValues[getValueIndex(x, y)];
-                               buffer.append("[").append(x).append("][").append(y).append("] = ").append(o).append("\n"); 
+               if (token_3_arrayValues == null) {
+                       buffer.append("  #values#uninitialised#\n");
+               } else {
+                       for (int x=0;x<getColumnCount();x++) {
+                               for (int y=0;y<getRowCount();y++) {
+                                       Object o = token_3_arrayValues[getValueIndex(x, y)];
+                                       buffer.append("[").append(x).append("][").append(y).append("] = ").append(o).append("\n"); 
+                               }
                        }
                }
                return buffer.toString();