Import rev.48371 from trunk: Add a couple of protections against potential invalid values (negative index and null pointer)


git-svn-id: https://root.cern.ch/svn/root/branches/v5-34-00-patches@48372 27541ba8-7e3a-0410-8455-c3a389f83636