Hadd of incompatible types

Hi,

one of my students reported that several of his files, produced with hadd would cause segfaults on reading, with error messages along the lines of
Error in TBasket::Streamer: The value of fNevBufSize is incorrect (-1040187392) ; trying to recover by setting it to zero

In the end, it turned out that it was actually his mistake, because he was trying to add the wrong files, and they contained a histogram and a TTree that both had the same name. While the problem is solved now, many hours were lost finding it, because the error message did not provide any clue toward the source of the problem.

To save us and other users from future headaches, would it be possible to add a protection to hadd that abort, or prints a warning message, if the inputs seem to be suspicious or outright incompatible?

Thank you and best regards
Kilian

Correction: it was a TTree and a TDirectory with the same name that caused the problem.