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      .@.y9......@?..

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);
    }

JulianUO added a commit to JulianUO/UOAscension-SphereX that referenced this pull request Sep 13, 2026
…and gameplay mechanics

- Integrated PR Sphereserver#1327: CLOSECONTAINER and CLOSEVENDORMENU client verbs
- Integrated PR Sphereserver#1590: CV_NUKE refactor and CV_NUKEITEM command
- Integrated PR Sphereserver#1589: PingFloodMax speedhack detection on packet 0x73
- Integrated PR Sphereserver#1587: NAME.PREFIX / NAME.SUFFIX in addItemName
- Integrated mtwango/edebaa6: lingering character reconnect handling
- Integrated PR Sphereserver#1568: immediate weather, light, and season sync on sector change
- Integrated PR Sphereserver#1566: optional bell curve parameter for SKILLCHECK
- Integrated PR Sphereserver#1600: safe dynamic_cast container owner check in CanContainerHold
- Integrated PR Sphereserver#1497: robust bitmask memory clear preserving MEMORY_IPET/MEMORY_FRIEND
- Integrated PR Sphereserver#1523: corpse item count and weight filtering for hair and special flags
- Integrated PR Sphereserver#1535: fix NpcLookAroundChance clamping and probability evaluation
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