Additional fix for #88417: Request to commit/port fixes to ANALYSIS/AliFileMerger...
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Dec 2011 12:29:47 +0000 (12:29 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Dec 2011 12:29:47 +0000 (12:29 +0000)
ANALYSIS/AliFileMerger.cxx

index d46e4e8..e78e97f 100644 (file)
@@ -436,7 +436,12 @@ int AliFileMerger::MergeRootfile( TDirectory *target, TList *sourcelist)
       //current_sourcedir->cd();
 
       TObject *obj = key->ReadObj();
-      
+      if (!obj) {
+       cout << "Failed to get the object with key " << key->GetName() << " from " << 
+         current_sourcedir->GetFile()->GetName() << "/" << current_sourcedir->GetName() << endl;
+       continue;
+      }
+
       if ( obj->IsA()->InheritsFrom( TTree::Class() ) ) {
        
        // loop over all source files create a chain of Trees "globChain"
@@ -499,6 +504,12 @@ int AliFileMerger::MergeRootfile( TDirectory *target, TList *sourcelist)
            TKey *key2 = (TKey*)gDirectory->GetListOfKeys()->FindObject(key->GetName());
            if (key2) {
              TObject *hobj = key2->ReadObj();
+             if (!hobj) {
+               cout << "Failed to get the object with key " << key2->GetName() << " from " << 
+                 ndir->GetFile()->GetName() << "/" << ndir->GetName() << endl;
+               continue;
+             }
+             //
              hobj->ResetBit(kMustCleanup);
              listH.Add(hobj);
              Int_t error = 0;