services: Check if service is #f before applying clause.

* gnu/services.scm (apply-clauses): Check if service is #f before trying to
apply clause.  Follow up of 1819512073.
This commit is contained in:
Josselin Poiret 2023-06-06 13:18:46 +02:00
parent 0ae29db11d
commit 1a2eb26286
No known key found for this signature in database
GPG Key ID: 505E40B916171A8A
1 changed files with 8 additions and 6 deletions

View File

@ -343,12 +343,14 @@ used."
((head . tail)
(let ((service clauses
(fold2 (lambda (clause service remainder)
(match clause
((kind proc properties)
(if (eq? kind (service-kind service))
(values (proc service) remainder)
(values service
(cons clause remainder))))))
(if service
(match clause
((kind proc properties)
(if (eq? kind (service-kind service))
(values (proc service) remainder)
(values service
(cons clause remainder)))))
(values #f (cons clause remainder))))
head
'()
clauses)))