square / mortar

A simple library that makes it easy to pair thin views with dedicated controllers, isolated from most of the vagaries of the Activity life cycle.
Apache License 2.0
2.16k stars 156 forks source link

BundleService.getBundleService() throws early #193

Open pyricau opened 8 years ago

pyricau commented 8 years ago

The code does this:

  public static BundleService getBundleService(Context context) {
    BundleServiceRunner runner = BundleServiceRunner.getBundleServiceRunner(context);
    if (runner == null) {
      throw new IllegalStateException(
          "You forgot to set up a " + BundleServiceRunner.class.getName() + " in your activity");
    }
    return runner.requireBundleService(MortarScope.getScope(context));
  }

runner can never be null. BundleServiceRunner.getBundleServiceRunner will throw is there is no BundleServiceRunner in the scope.