Skip to content

Enable null to remove server_message - #330

Open
jimmyih wants to merge 1 commit into
P0nk:masterfrom
jimmyih:remove_server_message
Open

jimmyih wants to merge 1 commit into
P0nk:masterfrom
jimmyih:remove_server_message

Conversation

@jimmyih

@jimmyih jimmyih commented Nov 16, 2025

Copy link
Copy Markdown

Description

An empty server message in config.yaml would cause a NullPointerException when logging in (after selecting your character to play) since the server message would be null while the code expects a string.

This change prevents an empty server_message in config.yaml causing the exception.

Error found when trying an empty server_message:

java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "value" is null
        at net.packet.ByteBufOutPacket.writeString(ByteBufOutPacket.java:74)
        at tools.PacketCreator.serverMessage(PacketCreator.java:1281)
        at tools.PacketCreator.serverMessage(PacketCreator.java:1220)
        at net.server.channel.Channel.addPlayer(Channel.java:271)
        at net.server.channel.handlers.PlayerLoggedinHandler.handlePacket(PlayerLoggedinHandler.java:228)
        at client.Client.channelRead(Client.java:221)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at ...

Error is now removed and server message on top of the view is gone when the config has a null server message.

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have tested my changes
  • I have added unit tests that prove my changes work

Screenshots

Server message removed when null / does not run into NullPointerException:
Null, No Error, Server Message Gone

Server message showing still with my changes (intended):
Server Message Working On Changes

MinatoNami added a commit to MinatoNami/Cosmic-AI that referenced this pull request Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant