Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #604 from johnflavin/flavin/603
Browse files Browse the repository at this point in the history
Only copy volumes if non-null
  • Loading branch information
mattnworb authored Feb 3, 2017
2 parents 30df02c + bad0952 commit c6e752d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
@JsonAutoDetect(fieldVisibility = ANY, getterVisibility = NONE, setterVisibility = NONE)
public abstract class VolumeList {

@Nullable
@JsonProperty("Volumes")
public abstract ImmutableList<Volume> volumes();

Expand All @@ -47,8 +48,10 @@ public abstract class VolumeList {
static VolumeList create(
@JsonProperty("Volumes") final List<Volume> volumes,
@JsonProperty("Warnings") final List<String> warnings) {
final ImmutableList<Volume> volumesCopy = volumes == null
? null : ImmutableList.copyOf(volumes);
final ImmutableList<String> warningsCopy = warnings == null
? null : ImmutableList.copyOf(warnings);
return new AutoValue_VolumeList(ImmutableList.copyOf(volumes), warningsCopy);
return new AutoValue_VolumeList(volumesCopy, warningsCopy);
}
}

0 comments on commit c6e752d

Please sign in to comment.