Fix JSON error when no custom question set

This commit is contained in:
Lucien Astié 2024-08-10 16:52:13 +02:00
parent 4338b11939
commit 87b7d9e246
2 changed files with 2 additions and 2 deletions

View file

@ -56,7 +56,7 @@ export default function GameRoom({ params }: roomProps) {
const localBrowserId = localStorage.getItem("browserId")
setBrowserId(localBrowserId)
const localCustomQuestionsString = localStorage.getItem("customQuestions")
const localCustomQuestions = JSON.parse(localCustomQuestionsString != null ? localCustomQuestionsString : "")
const localCustomQuestions = JSON.parse(localCustomQuestionsString != null ? localCustomQuestionsString : "{}")
setCustomQuestions(localCustomQuestions == null ? [] : localCustomQuestions)
// Listen for incoming setMessages