Seg Fault when using TObject::Get()

Dear experts

I want to use a TF2 function from a root file, I use
TF2* func = (TF2*)file->Get("func")
it doesn’t give error but after when I use func->Print() it gives seg fault…
Any clue of why this happens?

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Try: file->ls();

Thank you… I found the wrong point.