endless loop in RealFSImpl::EnsureDirectoryExists(
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
Medium
|
Nicolai Hähnle |
Bug Description
i found an endless loop in RealFSImpl:
The issue is that the condition (it != std::string::npos) in the while loop at line 307 is always true as the value of it is incremented after the call to std::string.find.
I suggest replacing that loop with :
while (it < dirname.size()) {
}
That worked for me, but there might be a directories issue that caused this. Ill check that after 1 or 2 games :)
Regards,
Charly
Related branches
- Tino: Approve
- Widelands Developers: Pending (crossplatform) requested
-
Diff: 166 lines (+45/-32)4 files modifiedsrc/io/filesystem/disk_filesystem.cc (+23/-21)
src/io/filesystem/filesystem.h (+2/-2)
src/io/filesystem/layered_filesystem.cc (+14/-3)
src/wlapplication.cc (+6/-6)
Changed in widelands: | |
status: | New → Confirmed |
assignee: | nobody → Nicolai Hähnle (nha) |
Changed in widelands: | |
milestone: | none → build16-rc1 |
There is definitely a problem in that code, though I'm suspicious about your fix. The problem is that if dirname does not end in a slash, e.g. dirname == "foo/bar", then your code will only create "foo", but not "foo/bar". Also, the way the recursive call to EnsureDirectory Exists works makes me really, really uneasy. I'm going to try a different approach.