Informations
Jump to content

Lorem Ipsum...

Click to Dismiss this Notification
Ładowanie danych...

Fix nullptr In Function For Transfer Items To The Safebox


Black_Rose©

Recommended Posts

📖 Outline of the Problem 📖

Anyone involved in creating servers for the game Metin2 is familiar with the importance of stability and reliability. In this context, an error in the CInputMain::SafeboxCheckin function can be a real trap, leading to server crashes and player frustration. 
This function is responsible for transferring items between the inventory and the warehouse, which is a crucial operation for every player. What's worse, the error occurs when trying to check the quest status. Surely none of us wants the server to crash at such a critical moment

📍 Problem Brief 📍
The error is due to the fact that the GetPCForce() method can return a nullptr, which is later used in the IsRunning() method. This is a classic case of a segmentation fault error, which can have serious consequences such as server crashes. 

📍 Function with the Problem 📍

The CInputMain::SafeboxCheckin function is used to check the items being transferred between the warehouse and the character's inventory. It includes various conditions and cases that must be met before the item is moved. It also involves checking various quests and their statuses, which leads to a potential segmentation fault error if not properly handled.

🛠️ Fixing Approach 🛠️

To avoid this, add a condition to check if the pointer returned by GetPCForce() is nullptr before calling the IsRunning() method.
Solution: File location: game -> input_main.cpp


Find:

This is the hidden content, please

Exchange To:

This is the hidden content, please

 

Link to comment
Share on other sites


  • 100% changed the title to Fix nullptr In Function For Transfer Items To The Safebox

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

spacer.png

Disable AdBlock
The popup will be closed in 5 seconds...