forked from MrBesen/lolautoaccept
fix endsWith bug
This commit is contained in:
parent
e67c18f2ce
commit
5f3ff9e292
|
@ -24,7 +24,7 @@ static const std::string CLIENTNAME = "LeagueClientUx.exe"; // returns the name
|
||||||
static std::shared_ptr<ClientAccess> findUsingLockfile(const std::vector<std::string>& cmdline, pid_t pid);
|
static std::shared_ptr<ClientAccess> findUsingLockfile(const std::vector<std::string>& cmdline, pid_t pid);
|
||||||
|
|
||||||
static bool endsWith(const std::string& all, const std::string& end) {
|
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)
|
// reads a procfile into a vector (strings are \0 seperated)
|
||||||
|
@ -71,7 +71,7 @@ std::shared_ptr<ClientAccess> ClientAccess::find() {
|
||||||
|
|
||||||
std::string& exename = args.at(0);
|
std::string& exename = args.at(0);
|
||||||
if(endsWith(exename, CLIENTNAME)) {
|
if(endsWith(exename, CLIENTNAME)) {
|
||||||
Log::info << CLIENTNAME << " found";
|
Log::info << CLIENTNAME << " found: " << exename;
|
||||||
|
|
||||||
std::shared_ptr<ClientAccess> out;
|
std::shared_ptr<ClientAccess> out;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue