Attemp of merge histogram failling

void k()
{
TFile *f1 = TFile::Open("/home/lucas/Downloads/aasd/asd/a.root");
TTree *tr1 = (TTree *) f1->Get("a");
tr1->Draw("hist");
TFile *f2 = TFile::Open("/home/lucas/Downloads/aasd/asd/b.root");
TTree *tr2 = (TTree *) f2->Get("b");
tr2->Draw("hist same");
TFile *f3 = TFile::Open("/home/lucas/Downloads/aasd/asd/c.root");
TTree *tr3 = (TTree *) f3->Get("c");
tr3->Draw("hist same");
}

When i run this code, i got the following error lines:

#0  0x00007fadc6886dba in wait4 () from /usr/lib/x86_64-linux-gnu/libc.so.6
#1  0x00007fadc67f60e7 in ?? () from /usr/lib/x86_64-linux-gnu/libc.so.6
#2  0x00007fadc6eda0ee in TUnixSystem::StackTrace() () from /home/lucas/Downloads/root_v6.24.06.Linux-ubuntu20-x86_64-gcc9.3/root/lib/libCore.so.6.24
#3  0x00007fadc249a5a0 in cling::MultiplexInterpreterCallbacks::PrintStackTrace() () from /home/lucas/Downloads/root_v6.24.06.Linux-ubuntu20-x86_64-gcc9.3/root/lib/libCling.so
#4  0x00007fadc248dce2 in cling_runtime_internal_throwIfInvalidPointer () from /home/lucas/Downloads/root_v6.24.06.Linux-ubuntu20-x86_64-gcc9.3/root/lib/libCling.so
#5  0x00007fadacdee12d in ?? ()
#6  0x0000000000000016 in ?? ()
#7  0x0000559a00dd3300 in ?? ()
#8  0x00007fff278dd410 in ?? ()
#9  0x00007fff278ddb00 in ?? ()
#10 0x0000000000000000 in ?? ()
Error in <HandleInterpreterException>: Trying to dereference null pointer or trying to call routine taking non-null arguments.
Execution of your code was aborted.
In file included from input_line_60:1:
/home/lucas/Downloads/aasd/asd/k.C:5:1: warning: null passed to a callee that requires a non-null argument [-Wnonnull]

Now, i can’t understand what does this error means. Is it a error in my code or something more complex, as for example, a problem in root installation?

To be more precise, i am trying to merge the three .root histograms above.

The last 2 lines give an explanation:

In file included from input_line_60:1:
/home/lucas/Downloads/aasd/asd/k.C:5:1: warning: null passed to a callee that requires a non-null argument [-Wnonnull]

so in line 5 (tr1->Draw("hist"); if what you showed is all the code) you are trying to call Draw on an empty (“null”) pointer. So “a” is not getting read into tr1 --maybe the file a.root is not found, or it can’t be read (no permission/damaged/…), or because the tree “a” is not in that file (or, if it is, it is inside a subdirectory) or some other problem reading it.
You have to make sure that:
1 - the root files are actually in the folders you think;
2 - those trees are inside those files and where you think they are.
You could add some checks and protections to the macro to find out which case it is:

TFile *f1 = TFile::Open("/home/lucas/Downloads/aasd/asd/a.root");
if (!f1) {
  cout << "a.root not found" << endl;
  return;
}
TTree *tr1 = (TTree *) f1->Get("a");
if (!tr1) {
  cout << "a Tree not found" << endl;
  return;
}
tr1->Draw("hist");
// and similar for b & c