diff --git a/ChangeLog b/ChangeLog
index e5ea0b9dc..de5aaad02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-08-12 Paolo Nenzi
+ * src/frontend/inpcom.c: fixed segmentation fault with empty .include file
+ or directory include. This is a hack the full inpcom shoud be rewritten.
+
2007-06-17 Gong Ding
* src/spicelib/devices/dev.c: use a more flexiable way to define device.
If it doesn't work, one can returen to old version (rename as dev_old.c).
diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c
index 3db4a89cc..a39d66b08 100644
--- a/src/frontend/inpcom.c
+++ b/src/frontend/inpcom.c
@@ -289,12 +289,13 @@ inp_readall(FILE *fp, struct line **data)
end->li_actual = NULL;
end->li_line = copy(buffer);
end->li_linenum = line_number++;
- end->li_next = newcard;
-
+ if (newcard) {
+ end->li_next = newcard;
/* Renumber the lines */
for (end = newcard; end && end->li_next; end = end->li_next)
end->li_linenum = line_number++;
- end->li_linenum = line_number++; /* SJB - renumber the last line */
+ end->li_linenum = line_number++; /* SJB - renumber the last line */
+ }
/* Fix the buffer up a bit. */
(void) strncpy(buffer + 1, "end of:", 7);