From 0ea3d4f4ac46c7ec8e39bb4f1131b747f19ab436 Mon Sep 17 00:00:00 2001 From: Kaaninchen <124433727+kaaninchen@users.noreply.github.com> Date: Mon, 3 Aug 2026 19:14:08 +0200 Subject: [PATCH] fix: check if controllers row is empty on GET /api/v1/controllers --- cmd/internal/routes/colors.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/internal/routes/colors.go b/cmd/internal/routes/colors.go index 8a6f520..1e5e195 100644 --- a/cmd/internal/routes/colors.go +++ b/cmd/internal/routes/colors.go @@ -21,11 +21,18 @@ func RegisterColorRoutes(mux *http.ServeMux) { func listColors(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() + colors, err := db.GetAllColors() if err != nil { utils.ErrorResponse(w, http.StatusInternalServerError, err.Error()) return } + + if colors == nil { + utils.ErrorResponse(w, http.StatusOK, "No controllers found") + return + } + utils.SuccessResponse(w, http.StatusOK, colors) }