I think you need a null check here. `getResourceResolver(adaptable)` could return null.