[Rt-commit] r19448 - rt/3.999/trunk/lib/RT

sartak at bestpractical.com sartak at bestpractical.com
Tue May 5 14:17:20 EDT 2009


Author: sartak
Date: Tue May  5 14:17:20 2009
New Revision: 19448

Modified:
   rt/3.999/trunk/lib/RT/Rule.pm

Log:
When a ticket is destroyed, don't let its rules run

Modified: rt/3.999/trunk/lib/RT/Rule.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Rule.pm	(original)
+++ rt/3.999/trunk/lib/RT/Rule.pm	Tue May  5 14:17:20 2009
@@ -61,6 +61,13 @@
 
 sub prepare {
     my $self = shift;
+
+    # When a ticket's DESTROY is called, its id can be undef
+    if (!defined($self->ticket_obj->id)) {
+        Jifty->log->debug("Prepare aborted because the ticket was garbage collected.");
+        return (0);
+    }
+
     return (0) if $self->_queue && $self->ticket_obj->queue->name ne $self->_queue;
     return 1;
 }


More information about the Rt-commit mailing list