diff --git a/README.md b/README.md index dee023f..4fedbb2 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ A simple script is provided to check for errors during development at [`./reacti In order to format the code in a uniform way run `cargo +nightly fmt`. -To run the program use `cargo r`; to run the release build use `cargo r --relase`. +To run the program use `cargo r`; to run the release build use `cargo r --release`. ## Native Application diff --git a/reaction_systems_gui/src/app_logic.rs b/reaction_systems_gui/src/app_logic.rs index 31727a6..2499aa9 100644 --- a/reaction_systems_gui/src/app_logic.rs +++ b/reaction_systems_gui/src/app_logic.rs @@ -109,7 +109,9 @@ fn generate_to_evaluate( let mut input_hashes = vec![]; match graph[n_id].user_data.template { - | NodeInstruction::SaveString | NodeInstruction::SaveSvg => { + | NodeInstruction::SaveString | + NodeInstruction::SaveSvg | + NodeInstruction::SaveRasterization => { res.push(n_id); invalid_ids.insert(n_id); outputs_cache.invalidate_outputs(graph, n_id); diff --git a/reaction_systems_gui/src/svg.rs b/reaction_systems_gui/src/svg.rs index 05dead1..728a147 100644 --- a/reaction_systems_gui/src/svg.rs +++ b/reaction_systems_gui/src/svg.rs @@ -26,6 +26,9 @@ pub(crate) struct Svg { impl Svg { pub(crate) fn parse_dot_string(dot_str: &str) -> Result { + if dot_str.is_empty() { + return Err("Dot string is empty".into()); + } let mut fontdb = fontdb::Database::new(); fontdb.load_system_fonts(); @@ -43,6 +46,9 @@ impl Svg { gb.visit_graph(&g); let mut graph = gb.get(); let mut svg = SVGWriter::new(); + if graph.num_nodes() == 0 { + return Err("No nodes in dot graph".into()); + } graph.do_it(false, false, false, &mut svg); // convert svg to string let content = svg.finalize();