Improve type handling
| @@ -6210,7 +6210,7 @@ export function resetChatState() { | ||
| 6210 | 6210 | // replaces deleted charcter name with system user since it will be displayed next. |
| 6211 | 6211 | name2 = (this_chid === undefined && neutralCharacterName) ? neutralCharacterName : systemUserName; |
| 6212 | 6212 | //unsets expected chid before reloading (related to getCharacters/printCharacters from using old arrays) |
| 6213 | - this_chid = undefined; | |
| 6213 | + setCharacterId(undefined); | |
| 6214 | 6214 | // sets up system user to tell user about having deleted a character |
| 6215 | 6215 | chat.splice(0, chat.length, ...SAFETY_CHAT); |
| 6216 | 6216 | // resets chat metadata |
| @@ -6239,12 +6239,14 @@ export function setExternalAbortController(controller) { | ||
| 6239 | 6239 | */ |
| 6240 | 6240 | export function setCharacterId(value) { |
| 6241 | 6241 | switch (typeof value) { |
| 6242 | + case 'bigint': | |
| 6242 | 6243 | case 'number': |
| 6243 | 6244 | this_chid = String(value); |
| 6244 | 6245 | break; |
| 6245 | 6246 | case 'string': |
| 6246 | 6247 | this_chid = !isNaN(parseInt(value)) ? value : undefined; |
| 6247 | 6248 | break; |
| 6249 | + case 'object': | |
| 6248 | 6250 | case 'undefined': |
| 6249 | 6251 | this_chid = undefined; |
| 6250 | 6252 | break; |