Index: trunk/glueforge/templates/psdb/pop.tt
===================================================================
--- trunk/glueforge/templates/psdb/pop.tt	(revision 5907)
+++ trunk/glueforge/templates/psdb/pop.tt	(revision 5960)
@@ -20,4 +20,10 @@
 
     rowSet = psDBSelectRows(dbh, [% table.namespace FILTER upper %]_TABLE_NAME, NULL, 1);
+    if (!rowSet) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item %s", [% table.namespace FILTER upper %]_INDEX_NAME);
+        psFree(row);
+        return NULL;
+    }
+
     row = psArrayGet(rowSet, 0);
     // FIXME: psArrayGet should increment the ref count
