public CacheRelevance cacheRelevance() {
CacheRelevance result = CacheRelevance.NONE;
for (ToggleableTextElement cache : this.cacheDependencies){
- if (cache.getState()){
- result = result.addCacheRelevance(cache.getRelevance());
+ if (cache != null){ //null should not happen anymore but just in case
+ if (cache.getState()){
+ result = result.addCacheRelevance(cache.getRelevance());
+ }
+ //add recursion for light dependencies
+ result = result.addCacheRelevance(cache.cacheRelevance().getLight());
}
- //add recursion for light dependencies
- result = result.addCacheRelevance(cache.cacheRelevance().getLight());
}
return result;
}
public void addDependsOnCache(ToggleableTextElement toggleElement) {
- cacheDependencies.add(toggleElement);
+ if (toggleElement != null){
+ cacheDependencies.add(toggleElement);
+ }
}
/**
protected void registerCacheRelevance(ICacheRelevantFormElement element, ToggleableTextElement... toggleableCaches) {
if (element != null && toggleableCaches != null) {
for (ToggleableTextElement toggleableCache : toggleableCaches){
- element.addDependsOnCache(toggleableCache);
+ if (toggleableCache != null){
+ element.addDependsOnCache(toggleableCache);
+ }
}
}
// updateCacheRelevance();