1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-24 02:08:48 +00:00

fix: 修复断言类空指针异常

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2017-09-29 18:44:22 +08:00
parent 9ae8b285e6
commit 0e4051f15d
2 changed files with 2 additions and 2 deletions

View File

@ -41,6 +41,6 @@ public class Assert<T> {
} }
public void runIsAssignable(Class clazz, Consumer<? super T> consumer) { public void runIsAssignable(Class clazz, Consumer<? super T> consumer) {
runIsTrue(clazz.isAssignableFrom(t.getClass()), () -> consumer.accept(t)); runIsTrue(t != null && clazz.isAssignableFrom(t.getClass()), () -> consumer.accept(t));
} }
} }

View File

@ -14,7 +14,7 @@ import pw.yumc.YumCore.bukkit.Log;
public class ServerPingTest { public class ServerPingTest {
@Test @Test
public void test() { public void test() {
val ping = new ServerPing("server.yumc.pw"); val ping = new ServerPing("play.i5mc.com");
ping.fetchData(); ping.fetchData();
Log.i("version: %s max: %s online: %s motd: %s", Log.i("version: %s max: %s online: %s motd: %s",
ping.getVersionName(), ping.getPlayersMax(), ping.getPlayersOnline(), ping.getMotd()); ping.getVersionName(), ping.getPlayersMax(), ping.getPlayersOnline(), ping.getMotd());