added null check for addAllInternal() , added test

fixes #3330