Fix crash on login with expired timed items
https://github.com/d1str4ught/m2dev-client-src/issues/69
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user