Skip to content

Commit

Permalink
fix 2198 : dead condition found by cppcheck
Browse files Browse the repository at this point in the history
this doesn't change the behviour since `std::string::npos` is defined as the largest size_t value, so `pos2 < pos` would in particular imply `pos2 != std::string::npos`
  • Loading branch information
gfgtdf committed Nov 14, 2017
1 parent 4684376 commit 3202558
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/scripting/lua_fileops.cpp
Expand Up @@ -96,7 +96,7 @@ static bool resolve_filename(std::string& filename, std::string currentdir, std:
break;
}
size_t pos2 = filename.find_last_of('/', pos - 1);
if(pos == std::string::npos || pos2 >= pos) {
if(pos2 == std::string::npos || pos2 >= pos) {
return false;
}
filename = filename.replace(pos2, pos- pos2 + 3, "");
Expand Down

0 comments on commit 3202558

Please sign in to comment.