You can drop this check now that you've modified the factory to always return an instance or throw an exception.