From 19d7519dfe28806b17ca2c741ae8a64129b6fed6 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 24 Nov 2012 05:27:16 -0700 Subject: [PATCH] don't fail when there's no user-specific docindex --- collects/setup/xref.rkt | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/collects/setup/xref.rkt b/collects/setup/xref.rkt index 5e43da5b75..0f853ed000 100644 --- a/collects/setup/xref.rkt +++ b/collects/setup/xref.rkt @@ -86,20 +86,23 @@ (or (and (box-cas! (cdr p) maybe-db #f) maybe-db) ;; ... create a new one - (doc-db-file->connection (car p)))]) - ((let/ec esc - ;; The db query: - (define result - (doc-db-key->path db key - #:fail (lambda () - ;; Rollback within a connection can be slow, - ;; so abandon the connection and try again: - (doc-db-disconnect db) - (esc (lambda () (try p)))))) - ;; cache the connection, if none is already cached: - (or (box-cas! (cdr p) #f db) - (doc-db-disconnect db)) - (lambda () result)))))) + (and (file-exists? (car p)) + (doc-db-file->connection (car p))))]) + (and + db + ((let/ec esc + ;; The db query: + (define result + (doc-db-key->path db key + #:fail (lambda () + ;; Rollback within a connection can be slow, + ;; so abandon the connection and try again: + (doc-db-disconnect db) + (esc (lambda () (try p)))))) + ;; cache the connection, if none is already cached: + (or (box-cas! (cdr p) #f db) + (doc-db-disconnect db)) + (lambda () result))))))) (define dest (or (try main-db) (try user-db))) (and dest ((dest->source done-ht) dest))]