Index: trunk/ippTools/src/regtool.c
===================================================================
--- trunk/ippTools/src/regtool.c	(revision 9189)
+++ trunk/ippTools/src/regtool.c	(revision 9232)
@@ -71,5 +71,5 @@
     char *query =
         "SELECT newExp.*"
-        "   FROM newExp"
+        " FROM newExp"
         " LEFT JOIN newImfile USING(exp_tag)"
         " LEFT JOIN rawScienceExp USING(exp_tag)"
@@ -91,7 +91,12 @@
     psArray *output = p_psDBFetchResult(config->dbh);
     if (!output) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        return false;
+    }
+    if (!psArrayLength(output)) {
         // XXX check psError here
-        psError(PS_ERR_UNKNOWN, false, "failed to fetch the database result");
-        return false;
+        psError(PS_ERR_UNKNOWN, false, "no pending newExp rows found");
+        psFree(output);
+        return true;
     }
 
@@ -144,7 +149,12 @@
     psArray *output = p_psDBFetchResult(config->dbh);
     if (!output) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        return false;
+    }
+    if (!psArrayLength(output)) {
         // XXX check psError here
-        psError(PS_ERR_UNKNOWN, false, "failed to fetch the database result");
-        return false;
+        psError(PS_ERR_UNKNOWN, false, "no pending newImfile rows found");
+        psFree(output);
+        return true;
     }
 
@@ -183,5 +193,5 @@
     psString query = psStringCopy(
         "SELECT newExp.*"
-        "   FROM newExp"
+        " FROM newExp"
         " LEFT JOIN newImfile USING(exp_tag)"
         " LEFT JOIN rawScienceExp USING(exp_tag)"
@@ -218,6 +228,11 @@
     psArray *output = p_psDBFetchResult(config->dbh);
     if (!output) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        return false;
+    }
+    if (!psArrayLength(output)) {
         // XXX check psError here
-        psError(PS_ERR_UNKNOWN, false, "failed to fetch the database result");
+        psError(PS_ERR_UNKNOWN, false, "no pending newExp rows found");
+        psFree(output);
         return false;
     }
@@ -510,8 +525,13 @@
     psFree(query);
 
-    psArray *newImfiles = p_psDBFetchResult(config->dbh);
-    if (!newImfiles) {
+    psArray *output = p_psDBFetchResult(config->dbh);
+    if (!output) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        return false;
+    }
+    if (!psArrayLength(output)) {
         // XXX check psError here
-        psError(PS_ERR_UNKNOWN, false, "failed to fetch the database result");
+        psError(PS_ERR_UNKNOWN, false, "no pending newImfile rows found");
+        psFree(output);
         return false;
     }
