Skip to content

Commit 1a35f16

Browse files
committed
Catching early if the representative atom array is empty
1 parent 7a1b158 commit 1a35f16

File tree

1 file changed

+4
-1
lines changed
  • biojava-structure/src/main/java/org/biojava/nbio/structure/cluster

1 file changed

+4
-1
lines changed

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)