Fix possible NullPointerException

Fix possible NullPointerException if input string is missing one of the
product types.