Skip to content

Commit

Permalink
Fixed openFile bug
Browse files Browse the repository at this point in the history
  • Loading branch information
proh14 committed Nov 3, 2024
1 parent 4041cfb commit a481bfc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,17 @@ void openFile(char *s) {
FILE *file = fopen(s, "r");
if (!file && errno != ENOENT) {
die("fopen");
}
} else if (errno == ENOENT) {

free(curbuf.filename);
free(curbuf.filename);

#ifdef _WIN32
curbuf.filename = _strdup(s);
curbuf.filename = _strdup(s);
#else
curbuf.filename = strdup(s);
curbuf.filename = strdup(s);
#endif

return;
}
curbuf.numrows = 0;
curbuf.cx = 0;
curbuf.cy = 0;
Expand Down

0 comments on commit a481bfc

Please sign in to comment.