From bedf0621185b3fc3443b2f25e4285515b07500fe Mon Sep 17 00:00:00 2001 From: savis <106487343+savisxss@users.noreply.github.com> Date: Mon, 5 Jan 2026 13:01:03 +0100 Subject: [PATCH] Fix crash on login with expired timed items https://github.com/d1str4ught/m2dev-client-src/issues/69 --- src/game/item.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/game/item.cpp b/src/game/item.cpp index d6c7840..f732ea3 100644 --- a/src/game/item.cpp +++ b/src/game/item.cpp @@ -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(); } }