From 5f3ff9e292d3d43e7cfa7ae77b096ddc859afe9f Mon Sep 17 00:00:00 2001 From: mrbesen Date: Sun, 26 Feb 2023 12:32:59 +0100 Subject: [PATCH] fix endsWith bug --- src/clientaccess_linux.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/clientaccess_linux.cpp b/src/clientaccess_linux.cpp index ff540ba..b54a101 100644 --- a/src/clientaccess_linux.cpp +++ b/src/clientaccess_linux.cpp @@ -24,7 +24,7 @@ static const std::string CLIENTNAME = "LeagueClientUx.exe"; // returns the name static std::shared_ptr findUsingLockfile(const std::vector& cmdline, pid_t pid); static bool endsWith(const std::string& all, const std::string& end) { - return all.rfind(end) == all.size() - end.size(); + return all.size() >= end.size() && all.rfind(end) == all.size() - end.size(); } // reads a procfile into a vector (strings are \0 seperated) @@ -71,7 +71,7 @@ std::shared_ptr ClientAccess::find() { std::string& exename = args.at(0); if(endsWith(exename, CLIENTNAME)) { - Log::info << CLIENTNAME << " found"; + Log::info << CLIENTNAME << " found: " << exename; std::shared_ptr out;