From 35f1675a00bc83fb910dbe1436b4ebb666b6ee58 Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 10 Nov 2022 21:52:52 +0100 Subject: [PATCH] fix: don't crash when closing before connecting to anything --- src/worker/visualizer.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/worker/visualizer.rs b/src/worker/visualizer.rs index 85ec2ac..08ac3b6 100644 --- a/src/worker/visualizer.rs +++ b/src/worker/visualizer.rs @@ -320,7 +320,10 @@ impl AppState { pub async fn worker(mut self, run:watch::Receiver) { let mut now; - let first_db_uri = self.db_uri.recv().await.unwrap(); + let Some(first_db_uri) = self.db_uri.recv().await else { + warn!(target: "state-manager", "No initial database URI, skipping first connection"); + return; + }; let mut db = Database::connect(first_db_uri.clone()).await.unwrap();