From d1828b6d0b9c36d295096903490d23eab4666471 Mon Sep 17 00:00:00 2001 From: pnenzi Date: Wed, 2 Jan 2008 12:55:53 +0000 Subject: [PATCH] Fix from Holger Vogt for two cinditions that caused segfault. --- ChangeLog | 6 ++++++ src/frontend/com_chdir.c | 6 +++--- src/frontend/inp.c | 6 ++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index c453e8e78..d0d930302 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-12-31 Holger Vogt + * src/frontend/com_chdir.c: fix for the crashing of ngspice under Windows when + started from windows explorer. + * src/frontend/inp.c: ngspice crashed when executing a file consisting of a simple + control section. Fixed. + 2007-12-29 Dietmar Warning * src/frontend/inpcom.c: 3/4 terminal recognition for bjt's * src/misc/string.c, stringutil.h: token function for bjt instance diff --git a/src/frontend/com_chdir.c b/src/frontend/com_chdir.c index cd06bb01f..e4f535ce6 100644 --- a/src/frontend/com_chdir.c +++ b/src/frontend/com_chdir.c @@ -49,9 +49,9 @@ com_chdir(wordlist *wl) } - - if (*s && chdir(s) == -1) - perror(s); + if (s != NULL) + if (chdir(s) == -1) + perror(s); if (copied) tfree(s); diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 3e44a301a..7a8043004 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -534,8 +534,10 @@ inp_spsource(FILE *fp, bool comfile, char *filename) } /* if (deck->li_next) */ /* look for and set temperature; also store param and .meas statements in circuit struct */ - ft_curckt->ci_param = NULL; - ft_curckt->ci_meas = NULL; + if (ft_curckt) { + ft_curckt->ci_param = NULL; + ft_curckt->ci_meas = NULL; + } for (dd = deck; dd; dd = dd->li_next) { /* get temp after numparam run on deck */