fix: check if path is empty (#116)

This commit is contained in:
tobiichi3227 2023-12-24 01:12:34 +08:00 committed by GitHub
parent c447f1195c
commit f8cab3c370
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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");