this throws a RAV but why

This commit is contained in:
Siepert123 2026-03-05 07:30:25 +01:00
parent 93c259181c
commit 63e4ddb62c

View file

@ -735,7 +735,7 @@ void CPlatformNetworkManagerStub::SearchForGames()
} }
#ifdef _WINDOWS64 //Should we have this windows64 only? idk i havent tested so... #ifdef _WINDOWS64 //Should we have this windows64 only? idk i havent tested so...
ifstream ServersTxt("servers.txt"); std::FILE* file = std::fopen("servers.txt", "r");
//Memory leak prevention //Memory leak prevention
if (allocatedServers != NULL) { if (allocatedServers != NULL) {
@ -744,9 +744,9 @@ void CPlatformNetworkManagerStub::SearchForGames()
} }
delete(allocatedServers); delete(allocatedServers);
} }
allocatedServers = new vector<FriendSessionInfo*>;
if (ServersTxt) { if (file) {
allocatedServers = new vector<FriendSessionInfo*>;
string line; string line;
wstring wline; wstring wline;
@ -756,8 +756,9 @@ void CPlatformNetworkManagerStub::SearchForGames()
wstring port; wstring port;
wstring name; wstring name;
while (getline(ServersTxt, line)) { char buffer[512];
wline = convStringToWstring(line); while (std::fgets(buffer, sizeof(buffer), file)) {
wline = convStringToWstring(buffer);
if (phase == 0) { if (phase == 0) {
ip = line; ip = line;
phase = 1; phase = 1;
@ -790,7 +791,8 @@ void CPlatformNetworkManagerStub::SearchForGames()
allocatedServers->push_back(info); allocatedServers->push_back(info);
} }
} }
ServersTxt.close();
delete(file);
} }
#endif #endif