mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-19 16:17:07 +00:00
strictNullChecks
This commit is contained in:
+20
-2
@@ -170,7 +170,7 @@ app.get(
|
||||
);
|
||||
|
||||
async function fetchLobbies(): Promise<number> {
|
||||
const fetchPromises = [];
|
||||
const fetchPromises: Promise<GameInfo | null>[] = [];
|
||||
|
||||
for (const gameID of publicLobbyIDs) {
|
||||
const controller = new AbortController();
|
||||
@@ -209,8 +209,26 @@ async function fetchLobbies(): Promise<number> {
|
||||
});
|
||||
|
||||
lobbyInfos.forEach((l) => {
|
||||
if (l.msUntilStart <= 250 || l.gameConfig.maxPlayers <= l.numClients) {
|
||||
if (
|
||||
"msUntilStart" in l &&
|
||||
typeof l.msUntilStart !== "undefined" &&
|
||||
l.msUntilStart <= 250
|
||||
) {
|
||||
publicLobbyIDs.delete(l.gameID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
"gameConfig" in l &&
|
||||
typeof l.gameConfig !== "undefined" &&
|
||||
"maxPlayers" in l.gameConfig &&
|
||||
typeof l.gameConfig.maxPlayers !== "undefined" &&
|
||||
"numClients" in l &&
|
||||
typeof l.numClients !== "undefined" &&
|
||||
l.gameConfig.maxPlayers <= l.numClients
|
||||
) {
|
||||
publicLobbyIDs.delete(l.gameID);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user