Skip to content

Commit

Permalink
Recover the validation of AuthlibInjectorServers.
Browse files Browse the repository at this point in the history
  • Loading branch information
burningtnt committed Jan 8, 2024
1 parent 30c92b3 commit e2fde19
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.jackhuang.hmcl.task.Schedulers;
import org.jackhuang.hmcl.task.Task;
import org.jackhuang.hmcl.util.gson.JsonUtils;
import org.jackhuang.hmcl.util.gson.TolerableValidationException;
import org.jackhuang.hmcl.util.gson.Validation;
import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.io.JarUtils;

Expand All @@ -37,7 +39,7 @@
import static org.jackhuang.hmcl.setting.ConfigHolder.config;
import static org.jackhuang.hmcl.util.Logging.LOG;

public final class AuthlibInjectorServers {
public final class AuthlibInjectorServers implements Validation {

public static final String CONFIG_FILENAME = "authlib-injectors.json";

Expand All @@ -53,6 +55,13 @@ private AuthlibInjectorServers(List<String> urls) {
this.urls = urls;
}

@Override
public void validate() throws JsonParseException, TolerableValidationException {
if (this.urls == null) {
throw new JsonParseException("authlib-injectors.json -> urls cannot be null.");
}
}

public static void init() {
Path configLocation;
Path jarPath = JarUtils.thisJarPath();
Expand Down

0 comments on commit e2fde19

Please sign in to comment.