From e5a66e1160796359d0c0264655b9af21ccfa5cbc Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 9 Nov 2019 19:01:20 -0600 Subject: [PATCH] [nostalgia/player] Fix loading from directory --- src/nostalgia/player/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nostalgia/player/main.cpp b/src/nostalgia/player/main.cpp index 94472f56..93833bcc 100644 --- a/src/nostalgia/player/main.cpp +++ b/src/nostalgia/player/main.cpp @@ -65,7 +65,8 @@ int main(int argc, const char **argv) { std::unique_ptr fs; std::vector rom; std::string path = argv[1]; - const std::string fsExt = path.substr(path.find_last_of('.')); + const auto lastDot = path.find_last_of('.'); + const std::string fsExt = lastDot != std::string::npos ? path.substr(lastDot) : ""; if (fsExt == ".oxfs") { rom = loadFileBuff(path.c_str()); if (!rom.size()) {