Skip to content

Commit a9c19cd

Browse files
committed
Fixed potential segfault
1 parent a3370d2 commit a9c19cd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spinc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,8 @@ doParseFile(const char *name, Module *P, int *is_dup, AST *paramlist)
644644

645645
f = fopen(fname, "r");
646646
if (!f) {
647-
int lineNum = current->Lptr->lineCounter;
648-
AST *errAst = DummyLineAst(lineNum);
647+
int lineNum = current ? current->Lptr->lineCounter : 0;
648+
AST *errAst = current ? DummyLineAst(lineNum) : NULL;
649649

650650
ERROR(errAst, "Unable to open file `%s': %s", fname, strerror(errno));
651651
exit(1);

0 commit comments

Comments
 (0)