Index: trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc	(revision 4979)
+++ trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc	(revision 4980)
@@ -927,4 +927,6 @@
   *fLog << endl;
 
+  TH1F *h = NULL;
+      
   for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
     {
@@ -949,5 +951,7 @@
       MBadPixelsPix          &bad    = (*fBadPixels)[i];
 
-      Stat_t overflow = histhi.GetHGausHist()->GetBinContent(histhi.GetHGausHist()->GetNbinsX()+1);
+      h = histhi.GetHGausHist();
+
+      Stat_t overflow = h->GetBinContent(h->GetNbinsX()+1);
       if (overflow > 0.1)
         {
@@ -958,5 +962,5 @@
         }
 
-      overflow = histhi.GetHGausHist()->GetBinContent(0);
+      overflow = h->GetBinContent(0);
       if (overflow > 0.1)
         {
@@ -989,5 +993,7 @@
           }
         
-        Stat_t overflow = histlo.GetHGausHist()->GetBinContent(histlo.GetHGausHist()->GetNbinsX()+1);
+        h = histlo.GetHGausHist();
+
+        Stat_t overflow = h->GetBinContent(h->GetNbinsX()+1);
         if (overflow > 0.1)
           {
@@ -998,5 +1004,5 @@
           }
 
-        overflow = histlo.GetHGausHist()->GetBinContent(0);
+        overflow = h->GetBinContent(0);
         if (overflow > 0.1)
           {
