you've said that in the case where this optional url isn't present, pass null to the videoIdFrom() method. This will immediately throw an NPE. Are you expecting this?