LANG-1050 Added null check on the type parameter and added related unit test.