Fix player-options and weighted-options failing to validate settings if a payer's name is entirely numeric (#2496)

This commit is contained in:
Chris Wilson
2023-11-24 16:50:32 -05:00
committed by GitHub
parent 15797175c7
commit e64c7b1cbb
2 changed files with 7 additions and 3 deletions

View File

@@ -210,7 +210,11 @@ class WeightedSettings {
let errorMessage = null;
// User must choose a name for their file
if (!settings.name || settings.name.trim().length === 0 || settings.name.toLowerCase().trim() === 'player') {
if (
!settings.name ||
settings.name.toString().trim().length === 0 ||
settings.name.toString().toLowerCase().trim() === 'player'
) {
userMessage.innerText = 'You forgot to set your player name at the top of the page!';
userMessage.classList.add('visible');
userMessage.scrollIntoView({
@@ -256,7 +260,7 @@ class WeightedSettings {
// Remove empty arrays
else if (
['exclude_locations', 'priority_locations', 'local_items',
['exclude_locations', 'priority_locations', 'local_items',
'non_local_items', 'start_hints', 'start_location_hints'].includes(setting) &&
settings[game][setting].length === 0
) {