From 60f43e37c24030df82d2b98dc52e6a6644b7c5e5 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 21 Jul 2021 11:19:53 +0100 Subject: [PATCH] Only unmarshal create content if specified --- clientapi/routing/createroom.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/clientapi/routing/createroom.go b/clientapi/routing/createroom.go index d394511a0..156abd521 100644 --- a/clientapi/routing/createroom.go +++ b/clientapi/routing/createroom.go @@ -207,10 +207,12 @@ func createRoom( } createContent := map[string]interface{}{} - if err = json.Unmarshal(r.CreationContent, &createContent); err != nil { - return util.JSONResponse{ - Code: http.StatusBadRequest, - JSON: jsonerror.BadJSON("invalid create content"), + if len(r.CreationContent) > 0 { + if err = json.Unmarshal(r.CreationContent, &createContent); err != nil { + return util.JSONResponse{ + Code: http.StatusBadRequest, + JSON: jsonerror.BadJSON("invalid create content"), + } } } createContent["creator"] = userID