summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libports/allocate-port.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libports/allocate-port.c b/libports/allocate-port.c
index 03839635..d3581db0 100644
--- a/libports/allocate-port.c
+++ b/libports/allocate-port.c
@@ -68,7 +68,8 @@ void *ports_allocate_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++;