From f6fa541f7f7914a683a4dcb9a3cf7dc2a3227ae4 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Sun, 12 Feb 2023 22:01:59 +0100 Subject: [PATCH] - Si no hi ha usuaris, o si se demana un index mes alt que el nombre de usuaris, ja no peta. --- jscore.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jscore.cpp b/jscore.cpp index bb9e7cd..c16a494 100644 --- a/jscore.cpp +++ b/jscore.cpp @@ -126,9 +126,11 @@ namespace jscore { return score.size(); } string getUserName(const int index) { + if (score.size()==0 || index >= score.size()) return ""; return score[index].name; } const int getPoints(const int index) { + if (score.size()==0 || index >= score.size()) return 0; return score[index].points; }