Skip to content

Commit 6d92b58

Browse files
committed
Fix crash introduced by cf3c602
1 parent 49e5265 commit 6d92b58

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

Client/core/ServerBrowser/CServerBrowser.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,13 +2444,32 @@ bool CServerBrowser::ProcessServerListRefreshBatch(ServerBrowserType type, size_
24442444
size_t processed = 0;
24452445
while (state.iterator != state.endIterator && processed < uiMaxSteps)
24462446
{
2447-
CServerListItem* pServer = *state.iterator;
2447+
CServerListItem* pServer = (state.iterator != state.endIterator) ? *state.iterator : nullptr;
2448+
2449+
// The list can briefly hand us null if an item was erased between batches
2450+
if (!pServer)
2451+
{
2452+
++state.iterator;
2453+
state.bNeedsListClear = true;
2454+
continue;
2455+
}
2456+
2457+
// Skip entries that were removed from the list while we were waiting to process them
2458+
if (!CServerListItem::StaticIsValid(pServer))
2459+
{
2460+
++state.iterator;
2461+
state.bNeedsListClear = true;
2462+
continue;
2463+
}
24482464

24492465
if (state.bNeedsListClear)
24502466
pServer->iRowIndex = -1;
24512467

24522468
if (type == ServerBrowserTypes::FAVOURITES || type == ServerBrowserTypes::RECENTLY_PLAYED)
2453-
GetServerCache()->GetServerCachedInfo(pServer);
2469+
{
2470+
if (pServer->Address.s_addr != 0 && pServer->usGamePort != 0)
2471+
GetServerCache()->GetServerCachedInfo(pServer);
2472+
}
24542473

24552474
if (pServer->revisionInList[type] != pServer->uiRevision || state.bClearServerList)
24562475
{

0 commit comments

Comments
 (0)