Fixed NPE for those cases where a primitive array was requested and `null` was passed as the default element (#537)