Index: /trunk/psLib/src/types/psLookupTable.c
===================================================================
--- /trunk/psLib/src/types/psLookupTable.c	(revision 12328)
+++ /trunk/psLib/src/types/psLookupTable.c	(revision 12329)
@@ -7,6 +7,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-03-07 02:42:22 $
+*  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-03-08 22:08:26 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -197,4 +197,5 @@
     psFree(table->filename);
     psFree(table->format);
+    psFree(table->index);
 }
 
@@ -419,17 +420,18 @@
 }
 
-psLookupTable *p_psLookupTableImport(const char *file,
-                                     unsigned int lineno,
-                                     const char *func,
-                                     psLookupTable *table,
-                                     psArray *vectors,
-                                     long indexCol)
-{
-    PS_ASSERT_LOOKUPTABLE_NON_NULL(table, NULL);
-    PS_ASSERT_ARRAY_NON_NULL(vectors, NULL);
+bool p_psLookupTableImport(const char *file,
+                           unsigned int lineno,
+                           const char *func,
+                           psLookupTable *table,
+                           psArray *vectors,
+                           long indexCol)
+{
+    PS_ASSERT_LOOKUPTABLE_NON_NULL(table, false);
+    PS_ASSERT_ARRAY_NON_NULL(vectors, false);
+    PS_ASSERT_INT_NONNEGATIVE(indexCol, false);
     if (indexCol >= vectors->n) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Index column, %ld, is larger"
                 " than number of columns, %ld.", indexCol, vectors->n);
-        return NULL;
+        return false;
     }
 
@@ -526,5 +528,5 @@
     }
 
-    return table;
+    return true;
 }
 
@@ -533,27 +535,21 @@
     PS_ASSERT_LOOKUPTABLE_NON_NULL(table, 0);
 
-    long            numRows  = 0;
-    psArray*        vectors  = NULL;
-    psLookupTable*  outTable = NULL;
-
     // Read vectors from file specified in table
-    vectors = psVectorsReadFromFile(table->filename, table->format);
-
-    // Check for valid array after reading from file
-    if (vectors != NULL) {
-
-        // Import vector into table
-        outTable = psLookupTableImport(table, vectors, table->indexCol);
-
+    psArray *vectors = psVectorsReadFromFile(table->filename, table->format); // Vectors in file
+    if (!vectors) {
+        psError(PS_ERR_UNKNOWN, false, "Unable to read vectors from %s", table->filename);
+        return 0;
+    }
+
+    // Import vector into table
+    if (!psLookupTableImport(table, vectors, table->indexCol)) {
+        psError(PS_ERR_UNKNOWN, false, "Unable to import vectors from %s into lookup table.",
+                table->filename);
         psFree(vectors);
-
-        // Update the number of rows read if outTable is not NULL
-        if (outTable != NULL) {
-            numRows = table->index->n;
-        }
-    }
-
-    // Return the number of lines read
-    return numRows;
+        return 0;
+    }
+    psFree(vectors);                // Drop reference
+
+    return table->index->n;
 }
 
@@ -716,6 +712,10 @@
     PS_ASSERT_VECTOR_NON_NULL(table->index, NULL);
     PS_ASSERT_ARRAY_NON_NULL(table->values, NULL);
-
     long numCols = table->values->n;
+    if (numCols == 0) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "No columns in lookup table from which to interpolate.");
+        return NULL;
+    }
+
     psVector *outVector = psVectorAlloc(numCols, PS_TYPE_F64);
 
Index: /trunk/psLib/src/types/psLookupTable.h
===================================================================
--- /trunk/psLib/src/types/psLookupTable.h	(revision 12328)
+++ /trunk/psLib/src/types/psLookupTable.h	(revision 12329)
@@ -6,6 +6,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-03-07 02:50:15 $
+*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-03-08 22:08:26 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -130,5 +130,5 @@
  */
 #ifdef DOXYGEN
-psLookupTable *psLookupTableImport(
+bool psLookupTableImport(
     psLookupTable *table,              ///< Lookup table into which to import
     const psArray *vectors,            ///< Array of vectors
@@ -136,5 +136,5 @@
 );
 #else // ifdef DOXYGEN
-psLookupTable *p_psLookupTableImport(
+bool p_psLookupTableImport(
     const char *file,                   ///< File of caller
     unsigned int lineno,                ///< Line number of caller
