From f504808e12ba7eb0abdf87c27b888d5a2ee837aa Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 20 Apr 2021 01:53:30 -0700 Subject: [PATCH] Oops, fix crash saving untitled outfits --- src/server/types/Outfit.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/types/Outfit.js b/src/server/types/Outfit.js index 3fcd047..38d52c4 100644 --- a/src/server/types/Outfit.js +++ b/src/server/types/Outfit.js @@ -137,7 +137,10 @@ const resolvers = { // Get the base name of the provided name: trim it, and strip any "(1)" // suffixes. - const baseName = rawName.replace(/\s*\([0-9]+\)\s*$/, ""); + const baseName = (rawName || "Untitled outfit").replace( + /\s*\([0-9]+\)\s*$/, + "" + ); const namePlaceholder = baseName.trim().replace(/_%/g, "\\$0") + "%"; // Then, look for outfits from this user with the same base name.