chore(network): null check
-// Copyright 2021 The Terasology Foundation
+// Copyright 2022 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.engine.network.internal;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
+import static com.google.common.base.Verify.verifyNotNull;
+
/**
* Authentication handler for the server end of the handshake
*/
@@ -41,8 +43,8 @@ public void channelActive(ChannelHandlerContext ctx) throws Exception {
super.channelActive(ctx);
serverConnectionHandler = ctx.pipeline().get(ServerConnectionHandler.class);
-
- PublicIdentityCertificate serverPublicCert = config.getSecurity().getServerPublicCertificate();
+ PublicIdentityCertificate serverPublicCert = verifyNotNull(config.getSecurity(), "config.security")
+ .getServerPublicCertificate();
new SecureRandom().nextBytes(serverRandom);
serverHello = NetData.HandshakeHello.newBuilder()
