Fix crash on login with expired timed items

https://github.com/d1str4ught/m2dev-client-src/issues/69
This commit is contained in:
savis
2026-01-05 13:01:03 +01:00
parent 807a93a80b
commit bedf062118

View File

@@ -2002,6 +2002,16 @@ bool CItem::OnAfterCreatedItem()
// Socket1에 아이템의 사용 횟수가 기록되어 있으니, 한 번이라도 사용한 아이템은 타이머를 시작한다.
if (0 != GetSocket(1))
{
// Check if item has already expired before starting the event
const time_t current = get_global_time();
if (current > GetSocket(0))
{
// Item has already expired while player was offline
// Remove it immediately to prevent crash during login
ITEM_MANAGER::instance().RemoveItem(this, "REAL_TIME_EXPIRE (expired offline)");
return false;
}
StartRealTimeExpireEvent();
}
}