- Common input and output data containers are now created automatically when attachin...
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTaskSE.cxx
index 96bf8e1535d100ddcf011bf9634049c5872b5659..a458069cf1c3876917bdcf7aee2137e6f2552c7d 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "AliAnalysisTaskSE.h"
 #include "AliAnalysisManager.h"
+#include "AliAnalysisDataSlot.h"
 #include "AliESDEvent.h"
 #include "AliESD.h"
 #include "AliAODEvent.h"
@@ -299,8 +300,9 @@ void AliAnalysisTaskSE::Exec(Option_t* option)
 
 // Call the user analysis    
     UserExec(option);
-    PostData(0, fTreeA);
-    
+    // Added protection in case the derived task is not an AOD producer.
+    AliAnalysisDataSlot *out0 = GetOutputSlot(0);
+    if (out0 && out0->IsConnected()) PostData(0, fTreeA);    
 }
 
 const char* AliAnalysisTaskSE::CurrentFileName()