[Rt-commit] r12903 - rt/branches/3.8-TESTING/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Wed Jun 4 18:39:25 EDT 2008


Author: ruz
Date: Wed Jun  4 18:39:25 2008
New Revision: 12903

Modified:
   rt/branches/3.8-TESTING/lib/RT/EmailParser.pm

Log:
* call rmtree only when we have $self->{'AttachmentDirs'}

Modified: rt/branches/3.8-TESTING/lib/RT/EmailParser.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/EmailParser.pm	(original)
+++ rt/branches/3.8-TESTING/lib/RT/EmailParser.pm	Wed Jun  4 18:39:25 2008
@@ -476,7 +476,7 @@
     # of File::Spec->tmpdir (e.g., /tmp) beacuse it isn't always
     # writable.
     my $tmpdir = File::Temp::tempdir( DIR => $RT::VarPath, CLEANUP => 1 );
-    push ( @{ $self->{'AttachmentDirs'} }, $tmpdir );
+    push ( @{ $self->{'AttachmentDirs'} ||= [] }, $tmpdir );
     $parser->output_dir($tmpdir);
     $parser->filer->ignore_filename(1);
 
@@ -504,7 +504,8 @@
 
 sub DESTROY {
     my $self = shift;
-    File::Path::rmtree([@{$self->{'AttachmentDirs'}}],0,1);
+    File::Path::rmtree([@{$self->{'AttachmentDirs'}}],0,1)
+        if $self->{'AttachmentDirs'};
 }
 
 


More information about the Rt-commit mailing list