From 8a534c0524c2307902e679ca62f279d147dc373c Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sat, 27 Jun 2015 16:16:12 -0400 Subject: [PATCH] Fix crash when loading scenarios packed by "tar -cf" --- src/tools/fileio_scen.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tools/fileio_scen.cpp b/src/tools/fileio_scen.cpp index 7ed15948..16d4372c 100644 --- a/src/tools/fileio_scen.cpp +++ b/src/tools/fileio_scen.cpp @@ -1896,6 +1896,8 @@ bool load_scenario_v2(fs::path file_to_load, cScenario& scenario, bool only_head for(auto& file : pack) { std::string fname = file.filename; int dot = fname.find_last_of('.'); + if(dot == std::string::npos) + continue; // No file extension? Can't be important. if(fname.substr(0,23) == "scenario/graphics/sheet") { if(fname.substr(dot,4) != ".png") continue; if(!std::all_of(fname.begin() + 23, fname.begin() + dot, isdigit)) continue;