forked from j62/ctbrec
1
0
Fork 0

Add null check

This commit is contained in:
0xboobface 2019-12-31 12:53:12 +01:00
parent 627eb585c8
commit d8e78bb910
1 changed files with 4 additions and 2 deletions

View File

@ -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()) {