Change NPE to IllegalState in Sponge loader's jarinjar presence check

This commit is contained in:
Vankka 2022-03-04 12:52:21 +02:00
parent bbfa71a4b2
commit da882301bc
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0

View File

@ -39,7 +39,6 @@ import java.io.IOException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.net.URL; import java.net.URL;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
@Plugin("discordsrv") @Plugin("discordsrv")
@ -102,7 +101,11 @@ public class DiscordSRVSpongeLoader implements ILoader {
@Override @Override
public @NotNull URL getJarInJarResource() { public @NotNull URL getJarInJarResource() {
return Objects.requireNonNull(getParentClassLoader().getResource("sponge.jarinjar")); URL resource = getParentClassLoader().getResource("sponge.jarinjar");
if (resource == null) {
throw new IllegalStateException("Jar does not contain jarinjar");
}
return resource;
} }
@Listener @Listener