Index: trunk/psModules/src/detrend/pmDetrendDB.c
===================================================================
--- trunk/psModules/src/detrend/pmDetrendDB.c	(revision 23268)
+++ trunk/psModules/src/detrend/pmDetrendDB.c	(revision 23600)
@@ -175,4 +175,5 @@
     if (!pipe) {
         psError (PS_ERR_IO, false, "error calling command %s", line);
+        psLogMsg ("psModules.detrend", PS_LOG_ERROR, "detselect command:\n %s\n", line);
         goto failure;
     }
@@ -188,4 +189,10 @@
         psError (PS_ERR_IO, false, "error running detselect");
         psLogMsg ("psModules.detrend", PS_LOG_ERROR, "detselect command:\n %s\n", line);
+        goto failure;
+    }
+
+    if (!buffer->data || strlen(buffer->data) == 0) {
+        psError(PS_ERR_IO, true, "Unable to find suitable detrend");
+        psLogMsg("psModules.detrend", PS_LOG_ERROR, "detselect command:\n %s\n", line);
         goto failure;
     }
