Skip to content

Commit

Permalink
default_main: prevent segmentation fault if accessing context->projec…
Browse files Browse the repository at this point in the history
…tName when the project is running from PATH and therefore strrchr returns NULL
  • Loading branch information
giuliomoro committed Jun 1, 2024
1 parent e7caa04 commit ee51d59
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/default_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ int main(int argc, char *argv[])
settings->cleanup = cleanup;
if(argc > 0 && argv[0])
{
settings->projectName = strrchr(argv[0], '/') + 1;
char* nameWithSlash = strrchr(argv[0], '/');
settings->projectName = nameWithSlash ? nameWithSlash + 1 : argv[0];
}

while (1) {
Expand Down

0 comments on commit ee51d59

Please sign in to comment.