From f8cab3c37004a31d00edaea7b57f2a3d940e0adb Mon Sep 17 00:00:00 2001 From: tobiichi3227 <86729076+tobiichi3227@users.noreply.github.com> Date: Sun, 24 Dec 2023 01:12:34 +0800 Subject: [PATCH] fix: check if path is empty (#116) --- src/config/ConfigManager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 51ab073..1971583 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -215,6 +215,9 @@ void CConfigManager::handleUnloadAll(const std::string& COMMAND, const std::stri // trim from both ends std::string CConfigManager::trimPath(std::string path) { + if (path.empty()) + return ""; + // trims whitespaces, tabs and new line feeds size_t pathStartIndex = path.find_first_not_of(" \t\r\n"); size_t pathEndIndex = path.find_last_not_of(" \t\r\n");