Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Nullpointer v111

Initiate Mage
Joined
Jul 18, 2021
Messages
1
Reaction score
0
Hi everyone,

I’ve been having alot of trouble trying to solve this nullpointerexception error for the past 5 days and I have tried everything to debug it to figure out what’s actually causing it, I saw how the code was being handled step by step and haven’t figured out.

I would really like if someone could tell me how I could fix this, I’m wondering if it’s more of a packet issue and if it is where would be the best step to start to try to fix it.

The error:
Code:
java.lang.NullPointerException    

at tools.packet.PacketHelper.addSkillInfo(PacketHelper.java:142)  
 
 at tools.packet.PacketHelper.addCharacterInfo(PacketHelper.java:637)    

at tools.packet.CField.getCharInfo(CField.java:1389)  
 
 at handling.channel.handler.InterServerHandler.Loggedin(InterServerHandler.java:178)   

 at handling.MapleServerHandler.handlePacket(MapleServerHandler.java:644)   

 at handling.MapleServerHandler.messageReceived(MapleServerHandler.java:490)  
 
 at 
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570)   

 at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)    

at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)    at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)    

at org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimpleProtocolDecoderOutput.java:58)   

 at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:180)    

at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)    

at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)    

at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)   

 at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220) 

   at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)  
 
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
 
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
 
 at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)  
 
 at java.lang.Thread.run(Unknown Source)
 
Initiate Mage
Joined
Jul 19, 2021
Messages
3
Reaction score
0
Post addSkillInfo code

Hi, I forgot the password for my previous account so had to make a new one. :(

This is the addSkillinfo:

PHP:
public static final void addSkillInfo(final MaplePacketLittleEndianWriter mplew, final MapleCharacter chr) { // 0x100

        final Map<Skill, SkillEntry> skills = chr.getSkills();

        boolean useOld = skills.size() < 500;

        mplew.write(useOld ? 1 : 0); // To handle the old skill system or something?

         if (useOld) {

            mplew.writeShort(skills.size());

            for (final Entry<Skill, SkillEntry> skill : skills.entrySet()) {

                mplew.writeInt(skill.getKey().getId());

                mplew.writeInt(skill.getValue().skillevel);

                addExpirationTime(mplew, skill.getValue().expiration);

                if (skill.getKey().isFourthJob()) {

                    mplew.writeInt(skill.getValue().masterlevel);

                }

            }

        } else {

            final Map<Integer, Integer> skillsWithoutMax = new LinkedHashMap<>();

            final Map<Integer, Long> skillsWithExpiration = new LinkedHashMap<>();

            final Map<Integer, Byte> skillsWithMax = new LinkedHashMap<>();

            // Fill in these maps

            for (final Entry<Skill, SkillEntry> skill : skills.entrySet()) {

                skillsWithoutMax.put(skill.getKey().getId(), skill.getValue().skillevel);

                if (skill.getValue().expiration > 0) {                    skillsWithExpiration.put(skill.getKey().getId(), skill.getValue().expiration);

                }

                if (skill.getKey().isFourthJob()) {

                    skillsWithMax.put(skill.getKey().getId(), skill.getValue().masterlevel);

                }

            }

            int amount = skillsWithoutMax.size();

            mplew.writeShort(amount);

            for (final Entry<Integer, Integer> x : skillsWithoutMax.entrySet()) {

                mplew.writeInt(x.getKey());

                mplew.writeInt(x.getValue()); // 80000000, 80000001, 80001040 show cid if linked.

            }

            mplew.writeShort(0); // For each, int

            amount = skillsWithExpiration.size();

            mplew.writeShort(amount);

            for (final Entry<Integer, Long> x : skillsWithExpiration.entrySet()) {

                mplew.writeInt(x.getKey());

                mplew.writeLong(x.getValue()); // Probably expiring skills here

            }            mplew.writeShort(0); // For each, int

            amount = skillsWithMax.size();

            mplew.writeShort(amount);

            for (final Entry<Integer, Byte> x : skillsWithMax.entrySet()) {

                mplew.writeInt(x.getKey());

                mplew.writeInt(x.getValue());

            }

            mplew.writeShort(0); // For each, int

        }

    }
 
Upvote 0
Initiate Mage
Joined
Jul 19, 2021
Messages
3
Reaction score
0
When do you see this pop-up? Can you replicate it to trigger the null pointer? If so, set a breakpoint then step into and follow where it shows null


It occurs when I attempt to login, it doesn't allow me to get in-game.

Post <font color="#666666">addSkillInfo code</font>

Hi, I forgot the password for my previous account so had to make a new one. :(
Also posted a reply earlier but it didn't go through for some reason.

I uploaded my addskillinfo in pastebin.
 
Upvote 0
Junior Spellweaver
Joined
Feb 18, 2018
Messages
117
Reaction score
10
What's the code in line 142? Because i don't see anything wrong on it
 
Upvote 0
Junior Spellweaver
Joined
Sep 16, 2017
Messages
156
Reaction score
36
If I were you, the first thing I'd check is how skills are loaded from database to populate the skills variable (such loading is commonly done in MapleCharacter, although I don't know which source you're working with).

Off the top of my head, I'd suggest making sure that you're not filling the map with null placeholders for skills that the player doesn't have (although I haven't seen this done anywhere yet).
 
Upvote 0
Junior Spellweaver
Joined
Feb 18, 2018
Messages
117
Reaction score
10
I think the problem is in loadFromData in skill.java make sure it is being loaded... because i never had this problem
 
Last edited:
Upvote 0
Back
Top