Preventing splice on undefined input for filter