Skip to content

Check if the container owner really exists - #1600

Open
mtwango wants to merge 1 commit into
Sphereserver:masterfrom
mtwango:container-owner-check-fix
Open

Check if the container owner really exists#1600
mtwango wants to merge 1 commit into
Sphereserver:masterfrom
mtwango:container-owner-check-fix

Conversation

@mtwango

@mtwango mtwango commented Sep 11, 2026

Copy link
Copy Markdown
Member

When checked container doesn't have an owner, it produces the following critical:

16:46:CRITICAL:Assert severity=2: 'pChar' file 'C:\GIT\Source-X\src\game\CResourceCalc.cpp', line 23, in ExcType=CAssert catched in SUB: CNetworkInput::ProcessMessage() ("Message")
16:46:DEBUG:Printing STACK TRACE for debugging purposes (thread id 1568).
16:46:DEBUG:_ thread name _ |   # | _____________ function _____________ |
16:46:DEBUG:         T_Main |   0 |     CNetworkManager::processAllInput | 
16:46:DEBUG:         T_Main |   1 |          CNetworkInput::processInput | 
16:46:DEBUG:         T_Main |   2 |           CNetworkInput::processData | 
16:46:DEBUG:         T_Main |   3 |           CNetworkInput::processData | 
16:46:DEBUG:         T_Main |   4 | CNetworkInput::processGameClientData | <-- exception catch point
16:46:DEBUG:         T_Main |   5 |         PacketItemDropReq::onReceive | 
16:46:DEBUG:         T_Main |   6 |             CClient::Event_Item_Drop | 
16:46:DEBUG:         T_Main |   7 |     CItemContainer::CanContainerHold | 
16:46:DEBUG:         T_Main |   8 |   CServerConfig::Calc_MaxCarryWeight | <-- last tracked function call (stack unwinding detected here)
16:46:DEBUG:1:Parsing Packet len=15 id=0x08 [2026/09/11 16:46:05]
        0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
       -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
0000   08 40 10 79 39 ff ff ff  ff 00 00 40 3f be aa      [email protected]......@?..

This PR checks for owner and it there is none, it doesn't calculate the option to carry more weight.

@mtwango

mtwango commented Sep 11, 2026

Copy link
Copy Markdown
Member Author

I wasn't able to reproduce, how to make it bugout, but some chests, that we have on ground produces this issue while others doesn't. Even when they have more, more2, link and baseid same, one produces critical and the other one doesn't.

However this check shouldn't cause any issues, since if the owner is found, it calculates like normally and when not, the calculation is skipped.

@GladieUO

Copy link
Copy Markdown
Contributor

Yup had this issue too long time ago.

Fixed it like this, I guess its very similar fix.
    if ((GetContainedLayer() == LAYER_PACK) && !(g_Cfg.m_iBackpackOverload <= -1))
    {
        CObjBase *pOwner = GetContainer();
        if (!pOwner || !pOwner->IsChar())
            return false;

        CChar *pCharContainerOwner = static_cast<CChar *>(pOwner);

        iMaxWeight += (g_Cfg.Calc_MaxCarryWeight(pCharContainerOwner) + g_Cfg.m_iBackpackOverload);
    }

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.

2 participants