Skip to content

Commit

Permalink
feat: now checks if there is at least one user
Browse files Browse the repository at this point in the history
  • Loading branch information
Tormak9970 committed May 19, 2023
1 parent 17b4b35 commit afa251b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
File renamed without changes.
10 changes: 9 additions & 1 deletion src/lib/controllers/AppController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,15 @@ export class AppController {
const users = await RustInterop.getSteamUsers();
steamUsers.set(users);

const activeUser = Object.values(users).find((user) => user.MostRecent == "1");
const usersList = Object.values(users);

if (usersList.length == 0) {
await dialog.message("No Steam Users found. SARM won't work without at least one user. Try signing into Steam after SARM closes.", { title: "No Users Detected", type: "error" });
LogController.error("Expected to find at least 1 Steam user but found 0.");
await process.exit(0);
}

const activeUser = usersList.find((user) => user.MostRecent == "1") ?? usersList[0];
activeUserId.set(parseInt(activeUser.id32));

await SettingsManager.setSettingsPath();
Expand Down

0 comments on commit afa251b

Please sign in to comment.