Return a copy of "customItems". - Vulnerability - Minor
For the below code getting Vulnerability, can someone assist with what to write instead:
@9944223
public List<OptionItem> getCustomItems() {
return customItems;
}
Passing this
@9944223
public List<OptionItem> getCustomItems() {
return List.copyOf(customItems);
}
@9944223
public List<OptionItem> getCustomItems() {
return customItems != null ? List.copyOf(customItems) : List.of();
}
getting null pointer exception