mirror of
https://github.com/Melledy/Nebula.git
synced 2026-09-20 01:29:54 +02:00
Avoid null pointer
This commit is contained in:
@@ -15,25 +15,25 @@ public class HandlerTowerGrowthGroupNodeUnlockReq extends NetHandler {
|
||||
public byte[] handle(GameSession session, byte[] message) throws Exception {
|
||||
// Parse request
|
||||
var req = UI32.parseFrom(message);
|
||||
|
||||
|
||||
// Quick unlock
|
||||
var change = session.getPlayer().getStarTowerManager().unlockGrowthNodeGroup(req.getValue());
|
||||
|
||||
|
||||
if (change == null) {
|
||||
session.encodeMsg(NetMsgId.tower_growth_group_node_unlock_failed_ack);
|
||||
return session.encodeMsg(NetMsgId.tower_growth_group_node_unlock_failed_ack);
|
||||
}
|
||||
|
||||
|
||||
// Get list of unlocked nodes
|
||||
var unlocked = (IntList) change.getExtraData();
|
||||
|
||||
|
||||
// Build response
|
||||
var rsp = TowerGrowthGroupNodeUnlockResp.newInstance()
|
||||
.setChangeInfo(change.toProto());
|
||||
|
||||
|
||||
for (int nodeId : unlocked) {
|
||||
rsp.addNodes(nodeId);
|
||||
}
|
||||
|
||||
|
||||
// Encode and send
|
||||
return session.encodeMsg(NetMsgId.tower_growth_group_node_unlock_succeed_ack, rsp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user