output: #fixed code
                               @SuppressWarnings("unchecked")
  	public static <T> void destroy(BeanManager beanManager, T instance) {
  		if (instance instanceof Class) { // Java prefers T over Class<T> when varargs is not specified :(
  			destroy(beanManager, (Class<T>) instance, new Annotation[0]);
  		}
  		else {
  			Bean<T> bean = (Bean<T>) resolve(beanManager, instance.getClass());
  
  			if (bean != null) {
  				destroy(beanManager, bean, instance);
  			}
  		}
  	}
input: #vulnerable code 
                               @SuppressWarnings("unchecked")
  	public static <T> void destroy(BeanManager beanManager, T instance) {
  		if (instance instanceof Class) {
  			destroy(beanManager, (Class<T>) instance, new Annotation[0]);
  		}
  		else if (instance instanceof Bean) {
  			destroy(beanManager, (Bean<T>) instance);
  		}
  		else {
  			Bean<T> bean = (Bean<T>) resolve(beanManager, instance.getClass());
  			bean.destroy(instance, beanManager.createCreationalContext(bean));
  		}
  	} 
                              #location 11 
                              #vulnerability type NULL_DEREFERENCE