Skip to content

Commit 5429339

Browse files
committed
Fix crash introduced by cf3c602
1 parent cef44d6 commit 5429339

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
@@ -2442,13 +2442,32 @@ bool CServerBrowser::ProcessServerListRefreshBatch(ServerBrowserType type, size_
24422442
size_t processed = 0;
24432443
while (state.iterator != state.endIterator && processed < uiMaxSteps)
24442444
{
2445-
CServerListItem* pServer = *state.iterator;
2445+
CServerListItem* pServer = (state.iterator != state.endIterator) ? *state.iterator : nullptr;
2446+
2447+
// The list can briefly hand us null if an item was erased between batches
2448+
if (!pServer)
2449+
{
2450+
++state.iterator;
2451+
state.bNeedsListClear = true;
2452+
continue;
2453+
}
2454+
2455+
// Skip entries that were removed from the list while we were waiting to process them
2456+
if (!CServerListItem::StaticIsValid(pServer))
2457+
{
2458+
++state.iterator;
2459+
state.bNeedsListClear = true;
2460+
continue;
2461+
}
24462462

24472463
if (state.bNeedsListClear)
24482464
pServer->iRowIndex = -1;
24492465

24502466
if (type == ServerBrowserTypes::FAVOURITES || type == ServerBrowserTypes::RECENTLY_PLAYED)
2451-
GetServerCache()->GetServerCachedInfo(pServer);
2467+
{
2468+
if (pServer->Address.s_addr != 0 && pServer->usGamePort != 0)
2469+
GetServerCache()->GetServerCachedInfo(pServer);
2470+
}
24522471

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

0 commit comments

Comments
 (0)