Skip to content

Commit

Permalink
storage: Fix exception modifying an emptyList() #TASK-5876
Browse files Browse the repository at this point in the history
  • Loading branch information
j-coll committed Apr 18, 2024
1 parent bde39d3 commit ab3c55e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.opencb.opencga.storage.core.variant.query.projection.VariantQueryProjection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -134,6 +135,10 @@ public VariantQueryResult(DataResult<T> dataResult) {
private void addSamplesMetadataIfRequested(ParsedVariantQuery query) {
VariantQueryProjection projection = query.getProjection();

// Ensure is modifiable
if (getEvents() == null || Collections.emptyList().getClass().equals(getEvents().getClass())) {
setEvents(new ArrayList<>());
}
if (!query.getEvents().isEmpty()) {
getEvents().addAll(query.getEvents());
}
Expand Down

0 comments on commit ab3c55e

Please sign in to comment.