aboutsummaryrefslogtreecommitdiff
path: root/pkg/api/api0
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api/api0')
-rw-r--r--pkg/api/api0/playerinfo.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/pkg/api/api0/playerinfo.go b/pkg/api/api0/playerinfo.go
index cacdbd6..b47ef4c 100644
--- a/pkg/api/api0/playerinfo.go
+++ b/pkg/api/api0/playerinfo.go
@@ -79,7 +79,17 @@ func (h *Handler) handlePlayer(w http.ResponseWriter, r *http.Request) {
return
}
- uid, err := strconv.ParseUint(r.URL.Query().Get("id"), 10, 64)
+ uidQ := r.URL.Query().Get("id")
+ if uidQ == "" {
+ respJSON(w, r, http.StatusBadRequest, map[string]any{
+ "success": false,
+ "error": ErrorCode_BAD_REQUEST,
+ "msg": fmt.Sprintf("%s: id param is required", ErrorCode_BAD_REQUEST.Message()),
+ })
+ return
+ }
+
+ uid, err := strconv.ParseUint(uidQ, 10, 64)
if err != nil {
respJSON(w, r, http.StatusNotFound, map[string]any{
"success": false,