Skip to content

Commit 185caf1

Browse files
committed
Tst:add input check
1 parent a2cb64d commit 185caf1

File tree

1 file changed

+2
-2
lines changed
  • Java/src/org/mlarocca/containers/strings/tst

1 file changed

+2
-2
lines changed

Java/src/org/mlarocca/containers/strings/tst/Tst.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public Tst() {
3030

3131
@Override
3232
public boolean add(String element) {
33-
if (element.isEmpty()) {
34-
throw new IllegalArgumentException("Keys must be non-empty");
33+
if (element == null || element.isEmpty()) {
34+
throw new IllegalArgumentException("Keys must be non-null and non-empty");
3535
}
3636
writeLock.lock();
3737
try {

0 commit comments

Comments
 (0)