tom-james-watson / wikitrivia

Wikidata as a trivia card game.
https://wikitrivia.tomjwatson.com
MIT License
497 stars 87 forks source link

Prevents the str.charAt crash #124

Open rowboat1 opened 5 months ago

rowboat1 commented 5 months ago

Game will periodically crash with a mysterious str.charAt error in the capitalize function. Mentioned in a comment in #95 though may not have been OP's problem.

One cause is in the type memo in item-card.tsx. It should always return a string, but in some cases returns undefined.

Punic Wars, for example, has a >60 character description, and is not a human, so it attempts to return the first element of its instance_of array, but the array is empty.