From 62e0d495ba1cbf82d316ca353ed3c41e3fc5b100 Mon Sep 17 00:00:00 2001 From: Hepatica Date: Sun, 18 Aug 2024 23:24:57 +0200 Subject: [PATCH] add null checks for delete and update --- SpCloudMain/SpCloudMain.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/SpCloudMain/SpCloudMain.cpp b/SpCloudMain/SpCloudMain.cpp index cff59cf..8b93843 100644 --- a/SpCloudMain/SpCloudMain.cpp +++ b/SpCloudMain/SpCloudMain.cpp @@ -102,6 +102,13 @@ int main() std::string name = req.get_file_value("Name").content; + if (name.empty() || name == " ") + { + res.set_content("Select another app name", "text/plain"); + + return; + } + std::string authorization_token = req.get_header_value("Authorization"); string is_user_banned = mongo_service.is_user_banned(authorization_token); @@ -139,6 +146,13 @@ int main() std::string name = req.get_file_value("Name").content; + if (name.empty() || name == " ") + { + res.set_content("Select another app name", "text/plain"); + + return; + } + std::string authorization_token = req.get_header_value("Authorization"); string is_user_banned = mongo_service.is_user_banned(authorization_token);