The organizer's Start button in the lobby only guards against having no players:
apps/frontend/src/screens/LiveQuiz.tsx (~line 349):
<button onClick={handleStart} disabled={participants.length === 0} ...>
Start Game
</button>
Nothing checks that the quiz has any questions.
Starting an empty quiz walks the room through quiz:start → the 3-second "GET
READY!" screen → quiz:next-question with index 0, which finds no question and
immediately ends the session:
if (!sessionId || !questions[questionIndex]) {
await endQuizSession(sessionId);
...
broadcastToSession(sessionId, 'quiz:ended');
}
Every participant sees "GET READY!" and then, three seconds later, "Quiz
Finished! Congratulations Winners!" with an empty podium. The session is now
COMPLETED in the database, so the host has to create a new one.
The same applies to a quiz whose questions were all deleted, and it fails
identically with 1 participant and 0 questions.
Where to fix it. The lobby does not currently fetch the question list, so
this needs the count available client-side — either included in the session
payload the organizer already receives on join, or fetched separately.
Guarding only in the UI is not quite enough, since the WebSocket message can be
sent directly; a server-side check in quiz:start would be the complete fix.
Frontend-only is still a worthwhile first step — say in your PR which you did.
Definition of done:
- The Start button is disabled when the quiz has no questions
- The disabled state explains why, rather than just being greyed out
- An empty quiz cannot be driven into a COMPLETED state by mistake
The organizer's Start button in the lobby only guards against having no players:
apps/frontend/src/screens/LiveQuiz.tsx(~line 349):Nothing checks that the quiz has any questions.
Starting an empty quiz walks the room through
quiz:start→ the 3-second "GETREADY!" screen →
quiz:next-questionwith index 0, which finds no question andimmediately ends the session:
Every participant sees "GET READY!" and then, three seconds later, "Quiz
Finished! Congratulations Winners!" with an empty podium. The session is now
COMPLETEDin the database, so the host has to create a new one.The same applies to a quiz whose questions were all deleted, and it fails
identically with 1 participant and 0 questions.
Where to fix it. The lobby does not currently fetch the question list, so
this needs the count available client-side — either included in the session
payload the organizer already receives on join, or fetched separately.
Guarding only in the UI is not quite enough, since the WebSocket message can be
sent directly; a server-side check in
quiz:startwould be the complete fix.Frontend-only is still a worthwhile first step — say in your PR which you did.
Definition of done: