From 5c2ec74a5ef8e9a389cf8ffdfff052b842e07a03 Mon Sep 17 00:00:00 2001 From: barsoosayque Date: Sun, 1 Dec 2024 23:13:16 +0700 Subject: [PATCH] editor: fix half width new theme button on round tab --- crates/opensi-editor/src/app/round_tab.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/opensi-editor/src/app/round_tab.rs b/crates/opensi-editor/src/app/round_tab.rs index 1d656da..ddc7353 100644 --- a/crates/opensi-editor/src/app/round_tab.rs +++ b/crates/opensi-editor/src/app/round_tab.rs @@ -66,9 +66,13 @@ fn round_themes( let Some(round) = package.get_round(idx) else { return; }; - let max_theme_len = - round.themes.iter().map(|theme| theme.questions.len()).max().unwrap_or_default(); - (max_theme_len + 2, round.themes.len() + 1) + if round.themes.is_empty() { + (1, 1) + } else { + let max_theme_len = + round.themes.iter().map(|theme| theme.questions.len()).max().unwrap_or_default(); + (max_theme_len + 2, round.themes.len() + 1) + } }; CardTable::new("round-themes").show(ui, count, |mut row| {