summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libports/intern-external-port.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libports/intern-external-port.c b/libports/intern-external-port.c
index 49139e7d..c60fc87e 100644
--- a/libports/intern-external-port.c
+++ b/libports/intern-external-port.c
@@ -72,7 +72,8 @@ void *ports_intern_external_port (struct port_bucket *bucket,
assert_perror (err);
pi->next = class->ports;
pi->prevp = &class->ports;
- class->ports->prevp = &pi->next;
+ if (class->ports)
+ class->ports->prevp = &pi->next;
class->ports = pi;
bucket->count++;
class->count++;