Add some error checking

This commit is contained in:
baz 2024-12-02 19:34:01 +00:00
parent fa9430cacb
commit 08a729e270
1 changed files with 12 additions and 3 deletions

View File

@ -264,7 +264,10 @@ async function GetFavouriteGenres() {
string = string.concat(` ${sortedCounts[genre][0]} (${sortedCounts[genre][1]} games),`); string = string.concat(` ${sortedCounts[genre][0]} (${sortedCounts[genre][1]} games),`);
} }
} }
string = string.slice(1, -1);
if (string.length > 1) {
string = string.slice(1, -1);
}
return string; return string;
} }
@ -301,7 +304,10 @@ async function GetFavouriteDevelopers() {
string = string.concat(` ${sortedCounts[developer][0]} (${sortedCounts[developer][1] } games),`); string = string.concat(` ${sortedCounts[developer][0]} (${sortedCounts[developer][1] } games),`);
} }
} }
string = string.slice(1, -1);
if (string.length > 1) {
string = string.slice(1, -1);
}
return string; return string;
} }
@ -339,7 +345,10 @@ async function GetFavouritePublishers() {
string = string.concat(` ${sortedCounts[publisher][0]} (${sortedCounts[publisher][1]} games),`); string = string.concat(` ${sortedCounts[publisher][0]} (${sortedCounts[publisher][1]} games),`);
} }
} }
string = string.slice(1, -1);
if (string.length > 1) {
string = string.slice(1, -1);
}
return string; return string;
} }