From afa251bcd80c4ce77b3f36412745505fa10e1b48 Mon Sep 17 00:00:00 2001 From: Tormak <63308171+Tormak9970@users.noreply.github.com> Date: Fri, 19 May 2023 10:19:54 -0500 Subject: [PATCH] feat: now checks if there is at least one user --- linux-installer_prototype.sh => linux-installer.sh | 0 src/lib/controllers/AppController.ts | 10 +++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) rename linux-installer_prototype.sh => linux-installer.sh (100%) diff --git a/linux-installer_prototype.sh b/linux-installer.sh similarity index 100% rename from linux-installer_prototype.sh rename to linux-installer.sh diff --git a/src/lib/controllers/AppController.ts b/src/lib/controllers/AppController.ts index 71ae4770..23c30d5c 100644 --- a/src/lib/controllers/AppController.ts +++ b/src/lib/controllers/AppController.ts @@ -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();