// Structurally similar fix private CLASS_1 METHOD_1(CLASS_2 VAR_1) { CLASS_3 VAR_2 = METHOD_2(VAR_1); if (VAR_2 != null) { return VAR_2.METHOD_3(CLASS_1.METHOD_4); } return null; }

NULL_DEREFERENCE

package com.adobe.acs.commons.models.injectors; import com.adobe.granite.xss.XSSAPI; import com.day.cq.wcm.api.Page; import com.day.cq.wcm.api.PageManager; ...

public class DefineObjectsInjector implements Injector {

private static Designer getDesigner(Object adaptable) {}

private ResourceResolver getResourceResolver(Object adaptable) {

if (adaptable instanceof SlingHttpServletRequest) { return ((SlingHttpServletRequest)adaptable).getResourceResolver(); } if (adaptable instanceof Resource) { return ((Resource)adaptable).getResourceResolver(); } return null;

}

private Designer getDesigner(Object adaptable) { <START_BUG> return getResourceResolver(adaptable).adaptTo(Designer.class); <END_BUG> }

}