diff options
-rw-r--r-- | libguile/fports.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libguile/fports.c b/libguile/fports.c index bcb5a1ecf..293aa1bfc 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -228,9 +228,15 @@ scm_i_evict_port (void *closure, SCM port) if (SCM_FPORTP (port)) { - scm_t_fport *fp = SCM_FSTREAM (port); + scm_t_port *p; + scm_t_fport *fp; + + /* XXX: In some cases, we can encounter a port with no associated ptab + entry. */ + p = SCM_PTAB_ENTRY (port); + fp = (p != NULL) ? (scm_t_fport *) p->stream : NULL; - if (fp->fdes == fd) + if ((fp != NULL) && (fp->fdes == fd)) { fp->fdes = dup (fd); if (fp->fdes == -1) |