Fitting plots with sub-ranges

I have a TGraphErrors object and I only want to fit a landau distribution on a certain range. However, I want to plot the fitted function to a larger range, so I do

TGraphErrors *plot = new TGraphErrors(stuff); \\this works
plot->Fit("landau","N","",0.5.25);  \\this works
TF1 *fit = plot->GetFunction("landau");  \\get fit function
fit->SetRange(0,7);  \\larger range for fit function
fit->Draw("same"); \\plot it

This doesn’t work though. The first two lines are fine, but I get errors when I use SetRange() or Draw(). Can anyone help?

You are getting an error when calling fit->SetRange because fit=0.
You have requested option “N” that means "do not store the fit function with the graph"
You should use option “0” instead.