Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At rutime, I was getting a segfault. A backtrace showed this:
(gdb) backtrace
#0 0x00007fff8a736162 in closedir ()
#1 0x00000001001a8b5a in file_finder::get_files_from_path (extension=@0x7fff5fbfa4f8, root_path=@0x7fff5fbfa4f0, recursive_search=true) at file_finder.cpp:73
#2 0x000000010084182c in get_tileset_names (dir_path=@0x7fff5fbfb738) at options.cpp:851
#3 0x00000001008447ef in initOptions () at options.cpp:315
#4 0x00000001004b38cb in main (argc=0, argv=0x7fff5fbff978) at main.cpp:66
stepping through showed this:
68 subdir = opendir(subpath.c_str());
(gdb)
69 if (subdir)
(gdb)
73 closedir(subdir);
(gdb)
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x00007fff8a736162 in closedir ()
(gdb) p subdir
$1 = (DIR *) 0x0
Moving the closedir command inside the brackets fixes the error.