aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/model/lint-warning.scm
diff options
context:
space:
mode:
authorDanjela Lura <danielaluraa@gmail.com>2020-05-28 22:27:48 +0200
committerChristopher Baines <mail@cbaines.net>2020-06-07 20:17:03 +0100
commitb8abe38352ff0513dee2bae87d3c17eba3c84339 (patch)
tree7946c37b66f64a71ad4e3bf8f538cf1f671e54ca /guix-data-service/model/lint-warning.scm
parentf67bea719d07cf48818bc0c2a1adca4edb291cd7 (diff)
downloaddata-service-b8abe38352ff0513dee2bae87d3c17eba3c84339.tar
data-service-b8abe38352ff0513dee2bae87d3c17eba3c84339.tar.gz
Add checks to guard against null data
Signed-off-by: Christopher Baines <mail@cbaines.net>
Diffstat (limited to 'guix-data-service/model/lint-warning.scm')
-rw-r--r--guix-data-service/model/lint-warning.scm30
1 files changed, 16 insertions, 14 deletions
diff --git a/guix-data-service/model/lint-warning.scm b/guix-data-service/model/lint-warning.scm
index f22681b..6c83773 100644
--- a/guix-data-service/model/lint-warning.scm
+++ b/guix-data-service/model/lint-warning.scm
@@ -36,20 +36,22 @@
(define (insert-guix-revision-lint-warnings conn
guix-revision-id
lint-warning-ids)
- (exec-query
- conn
- (string-append
- "INSERT INTO guix_revision_lint_warnings (lint_warning_id, guix_revision_id) "
- "VALUES "
- (string-join
- (map (lambda (lint-warning-id)
- (simple-format
- #f
- "(~A, ~A)"
- lint-warning-id
- guix-revision-id))
- lint-warning-ids)
- ", "))))
+ (if (null? lint-warning-ids)
+ '()
+ (exec-query
+ conn
+ (string-append
+ "INSERT INTO guix_revision_lint_warnings (lint_warning_id, guix_revision_id) "
+ "VALUES "
+ (string-join
+ (map (lambda (lint-warning-id)
+ (simple-format
+ #f
+ "(~A, ~A)"
+ lint-warning-id
+ guix-revision-id))
+ lint-warning-ids)
+ ", ")))))
(define* (lint-warnings-for-guix-revision conn commit-hash
#:key