forked from j62/ctbrec
Add null check
This commit is contained in:
parent
627eb585c8
commit
d8e78bb910
|
@ -1,5 +1,6 @@
|
|||
package ctbrec;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -10,6 +11,7 @@ public class Version implements Comparable<Version> {
|
|||
String designator = "";
|
||||
|
||||
public static Version of(String s) {
|
||||
Objects.requireNonNull(s, "Version string cannot be null");
|
||||
Pattern p = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)(?:-(.+))?");
|
||||
Matcher m = p.matcher(s);
|
||||
if (m.matches()) {
|
||||
|
|
Loading…
Reference in New Issue