Skip to content

Commit e8eb0a6

Browse files
authored
Merge pull request #635 from josemduarte/catchEmptySubunits
Catching early if the representative atom array is empty
2 parents 7a1b158 + 1a35f16 commit e8eb0a6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • biojava-structure/src/main/java/org/biojava/nbio/structure/cluster

biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/Subunit.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class Subunit {
5757
* Atoms were obtained.
5858
*
5959
* @param repAtoms
60-
* representative Atoms. It cannot be null
60+
* representative Atoms. It cannot be null or empty
6161
* @param name
6262
* String field that identifies the Subunit. It can be null
6363
* @param identifier
@@ -71,6 +71,9 @@ public Subunit(Atom[] reprAtoms, String name,
7171
if (reprAtoms == null)
7272
throw new IllegalArgumentException(
7373
"Representative Atom Array of the Subunit is null");
74+
if (reprAtoms.length==0)
75+
throw new IllegalArgumentException(
76+
"Representative Atom Array of the Subunit has 0 length");
7477

7578
this.reprAtoms = reprAtoms;
7679
this.name = name;

0 commit comments

Comments
 (0)