From d9efbfb178f0b12cad58616b9d27fe4b6f499ee4 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sun, 22 Jan 2017 16:50:55 +0100 Subject: [PATCH] pcsx2: don't use npos as array index --- pcsx2/IopBios.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pcsx2/IopBios.cpp b/pcsx2/IopBios.cpp index 7f66647e43..b3efda6993 100644 --- a/pcsx2/IopBios.cpp +++ b/pcsx2/IopBios.cpp @@ -331,9 +331,11 @@ namespace ioman { bool is_host(const std::string path) { - if ((!g_GameStarted || EmuConfig.HostFs) && 0 == path.compare(0, 4, "host") && path[path.find_first_not_of("0123456789", 4)] == ':') - return true; - return false; + auto not_number_pos = path.find_first_not_of("0123456789", 4); + if (not_number_pos == std::string::npos) + return false; + + return ((!g_GameStarted || EmuConfig.HostFs) && 0 == path.compare(0, 4, "host") && path[not_number_pos] == ':'); } int open_HLE()