Skip to content

Commit

Permalink
Fix crash with empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
azubieta committed Oct 30, 2020
1 parent 5903d75 commit a9556e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/file_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ char** apprun_read_lines(FILE* fp) {

// remove new line char if present
unsigned len = strlen(buf);
if (buf[len - 1] == '\n')
if (len > 0 && buf[len - 1] == '\n')
buf[len - 1] = 0;

result[i] = strdup(buf);
Expand Down

0 comments on commit a9556e9

Please sign in to comment.