瀏覽代碼

parser: Fail gracefully if a nonexistent file is passed on the command line

Before, if a nonexistent file was passed to LoadFileText(), it would
return NULL, and the parser would happily dereference it.
pull/2765/head
Peter0x44 2 年之前
父節點
當前提交
0a679d794a
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: A8DEAD1A4BB82440
共有 1 個檔案被更改,包括 6 行新增0 行删除
  1. +6
    -0
      parser/raylib_parser.c

+ 6
- 0
parser/raylib_parser.c 查看文件

@ -207,6 +207,12 @@ int main(int argc, char* argv[])
int length = 0;
char *buffer = LoadFileText(inFileName, &length);
if (buffer == NULL)
{
printf("Could not read input file: %s\n", inFileName);
return 1;
}
// Preprocess buffer to get separate lines
// NOTE: GetTextLines() also removes leading spaces/tabs
int linesCount = 0;

Loading…
取消
儲存