#vulnerable code 
                             public <S, T> Instantiator<S, T> getInstantiator(final Class<S> source, final Class<T> target) throws NoSuchMethodException, SecurityException {
		final Constructor<T> constructor = getSmallerConstructor(target);
		
		Object[] args;
		
		if (constructor.getParameterTypes().length == 0) {
			
			if (asmFactory != null && Modifier.isPublic(constructor.getModifiers())) {
				try {
					return asmFactory.createEmptyArgsInstatiantor(source, target);
				} catch (Exception e) {
					// fall back on reflection
				}
			}
			
			args = EMPTY_ARGS;
		} else {
			args = new Object[constructor.getParameterTypes().length];
			for(int i = 0; i < args.length; i++) {
				if (constructor.getParameterTypes()[i].isPrimitive()) {
					args[i] = DEFAULT_VALUES.get(constructor.getParameterTypes()[i]);
				}
			}
		}
		
		constructor.setAccessible(true);
		
		return new StaticConstructorInstantiator<S, T>(constructor, args); 
	} 
                            #location 6 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                             public <S, T> Instantiator<S, T> getInstantiator(final Class<S> source, final Class<T> target) throws NoSuchMethodException, SecurityException {
		final Constructor<T> constructor = getSmallerConstructor(target);
		
		if (constructor == null) {
			throw new NoSuchMethodException("No available constructor for " + target);
		}
		
		Object[] args;
		
		if (constructor.getParameterTypes().length == 0) {
			
			if (asmFactory != null && Modifier.isPublic(constructor.getModifiers())) {
				try {
					return asmFactory.createEmptyArgsInstatiantor(source, target);
				} catch (Exception e) {
					// fall back on reflection
				}
			}
			
			args = EMPTY_ARGS;
		} else {
			args = new Object[constructor.getParameterTypes().length];
			for(int i = 0; i < args.length; i++) {
				if (constructor.getParameterTypes()[i].isPrimitive()) {
					args[i] = DEFAULT_VALUES.get(constructor.getParameterTypes()[i]);
				}
			}
		}
		
		constructor.setAccessible(true);
		
		return new StaticConstructorInstantiator<S, T>(constructor, args); 
	}