Changing TMultiGraph Axis range results in bus error

Hi rooters

I am getting a bus error when I attempt to change the range of the x-axis of a multigraph which is stored in a root file. The method I call is multi_gr->GetXaxis()->SetLimits(10.0,100.0) which is the source of the error. In fact I can’t seem to call any methods in TAxis without my code crashing.

The full code is

 void DrawGraph(){
  TFile *file = new TFile("fitted_graphs.root","READ");
  
  TMultiGraph *multi_gr;
  char *Title;
  string str = "state_fidelity_";
  string pdf_title = str+"plots.pdf";
  Title = new char [pdf_title.size()];
  
  TCanvas *c = new TCanvas("comp","Plots", 300, 200); 
  
  gStyle->SetOptFit(1111);
  char * Tplotname = new char [str.size()+2];
  
  ostringstream temp_string;	 
  temp_string<<str;
  temp_string<<1;
  
  strcpy (Tplotname, (temp_string.str()).c_str());	 
  
  file->GetObject(Tplotname,multi_gr);
  
  multi_gr->SetMaximum(1.0);
  multi_gr->SetMinimum(0.0000001);
  multi_gr->GetXaxis()->SetLimits(10.0,100.0);
  
  c->SetLogy();
  c->SetLogx();
  multi_gr->Draw("ap");
  gStyle->SetOptFit(1111);
  c->BuildLegend();
  c->Print(pdf_title.c_str());
  
  delete c;
  delete Title;
  delete file; 
}

if (multi_gr) { // make sure it really exists multi_gr->Draw("ap"); // draw it gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn; multi_gr->SetMaximum(1.0); multi_gr->SetMinimum(0.0000001); multi_gr->GetXaxis()->SetLimits(10.0,100.0); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn; } else {std::cout << "Error : multi_gr == 0" << std::endl;}