Fixed a small bug: when deleting the only top cell, you could not create new cells as an error was issued saying 'no layout present'

This commit is contained in:
Matthias Koefferlein 2024-09-01 21:27:25 +02:00
parent bc78f4a0e9
commit a4467cfd3e
1 changed files with 3 additions and 2 deletions

View File

@ -1230,11 +1230,12 @@ LayoutViewFunctions::do_cm_paste (bool interactive)
void
LayoutViewFunctions::cm_new_cell ()
{
lay::CellView cv = view ()->cellview (view ()->active_cellview_index ());
if (! cv.is_valid ()) {
if (view ()->active_cellview_index () < 0) {
throw tl::Exception (tl::to_string (tr ("No layout present to add a cell to")));
}
lay::CellView cv = view ()->cellview (view ()->active_cellview_index ());
static double s_new_cell_window_size = 2.0;
static std::string s_new_cell_cell_name;