Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit db6ae6d

Browse files
committed
Fixed missing file check in gherkin-c
This fixes #394. This is not the best fix but will provide a basis for discussion about how we want to handle this.
1 parent 09567f7 commit db6ae6d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/file_reader.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ const wchar_t* FileReader_read(FileReader* file_reader) {
2121
int pos = 0;
2222
long code_point;
2323
FILE* file = fopen(file_reader->file_name, "rb");
24+
25+
if(file == NULL) {
26+
swprintf(buffer, sizeof(wchar_t), L"%c", ' ');
27+
return buffer;
28+
}
29+
2430
Utf8Source* utf8_source = FileUtf8Source_new(file);
31+
2532
do {
2633
code_point = UnicodeUtilities_read_code_point_from_utf8_source(utf8_source);
2734
if (code_point != WEOF) {

0 commit comments

Comments
 (0)