Skip to content

Commit 96c6816

Browse files
committed
Better fix for null subunits as advised by @lafita
1 parent b2555f6 commit 96c6816

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryResults.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ public QuatSymmetryResults(List<SubunitCluster> clusters,
9898
this.clusters = clusters;
9999
this.stoichiometry = SubunitClusterUtils
100100
.getStoichiometryString(clusters);
101+
102+
subunits = new ArrayList<Subunit>();
103+
for (SubunitCluster c : clusters) {
104+
subunits.addAll(c.getSubunits());
105+
}
101106

102107
this.helixLayers = helixLayers;
103108
this.method = method;
@@ -117,11 +122,8 @@ public List<SubunitCluster> getSubunitClusters() {
117122
*
118123
* @return an unmodifiable view of the List
119124
*/
120-
public List<Subunit> getSubunits() {
121-
if (subunits != null)
122-
return Collections.unmodifiableList(subunits);
123-
else
124-
return Collections.unmodifiableList(new ArrayList<>());
125+
public List<Subunit> getSubunits() {
126+
return Collections.unmodifiableList(subunits);
125127
}
126128

127129
/**

0 commit comments

Comments
 (0)