From 73db450b8b69f4a24b5b0e8624591cbd93a095e1 Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Tue, 24 Jun 2025 15:46:15 +0300 Subject: [PATCH] sim: when loading bug, dont panic if there are no runs --- simulator/runner/bugbase.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/simulator/runner/bugbase.rs b/simulator/runner/bugbase.rs index c9b1e3a90..3bfb05a9c 100644 --- a/simulator/runner/bugbase.rs +++ b/simulator/runner/bugbase.rs @@ -279,12 +279,11 @@ impl BugBase { })?; let plan: InteractionPlan = serde_json::from_str(&plan) .with_context(|| "should be able to deserialize plan")?; - let runs = std::fs::read_to_string(self.path.join(seed.to_string()).join("runs.json")) - .with_context(|| "should be able to read runs file")?; - let runs: Vec = serde_json::from_str(&runs) - .with_context(|| "should be able to deserialize runs")?; + .with_context(|| "should be able to read runs file") + .and_then(|runs| serde_json::from_str(&runs).map_err(|e| anyhow!("{}", e))) + .unwrap_or_default(); let bug = LoadedBug { seed,