diff --git a/src/main/java/net/frozenorb/apiv3/web/route/serverGroups/POSTServerGroups.java b/src/main/java/net/frozenorb/apiv3/web/route/serverGroups/POSTServerGroups.java index 94c6522..d653b39 100644 --- a/src/main/java/net/frozenorb/apiv3/web/route/serverGroups/POSTServerGroups.java +++ b/src/main/java/net/frozenorb/apiv3/web/route/serverGroups/POSTServerGroups.java @@ -25,7 +25,7 @@ public final class POSTServerGroups implements Handler { String image = requestBody.getString("image"); ServerGroup serverGroup = new ServerGroup(id, image); - SyncUtils.runBlocking(v -> serverGroup.insert(v)); + SyncUtils.runBlocking(serverGroup::insert); if (requestBody.containsKey("addedBy")) { AuditLog.log(UuidUtils.parseUuid(requestBody.getString("addedBy")), requestBody.getString("addedByIp"), ctx, AuditLogActionType.SERVER_GROUP_CREATE, ImmutableMap.of("serverGroupId", id), (ignored, error) -> { diff --git a/src/main/java/net/frozenorb/apiv3/web/route/servers/POSTServersHeartbeat.java b/src/main/java/net/frozenorb/apiv3/web/route/servers/POSTServersHeartbeat.java index da01e65..5436fcb 100644 --- a/src/main/java/net/frozenorb/apiv3/web/route/servers/POSTServersHeartbeat.java +++ b/src/main/java/net/frozenorb/apiv3/web/route/servers/POSTServersHeartbeat.java @@ -75,14 +75,16 @@ public final class POSTServersHeartbeat implements Handler { private Future createInfoResponse(Server server, double tps, Map playerNames) { Future callback = Future.future(); - server.receivedHeartbeat(tps, playerNames.keySet()); - server.save((ignored, error) -> { - if (error != null) { - callback.fail(error); - } else { - callback.complete(); - } - }); + if (server != null && playerNames != null) { + server.receivedHeartbeat(tps, playerNames.keySet()); + server.save((ignored, error) -> { + if (error != null) { + callback.fail(error); + } else { + callback.complete(); + } + }); + } return callback; }