Index: trunk/ippScripts/scripts/detrend_stack.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_stack.pl	(revision 23186)
+++ trunk/ippScripts/scripts/detrend_stack.pl	(revision 23295)
@@ -251,4 +251,6 @@
     my $exit_code = shift; # Exit code to add
 
+    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
+
     carp($msg);
     if (defined $det_id and defined $iter and defined $class_id and not $no_update) {
