From 91eb4ecb4c9c0ebfbc301837292398d224a8916c Mon Sep 17 00:00:00 2001 From: flurick Date: Nov 02 2022 12:02:42 +0000 Subject: Keep selection valid when cutting frames Fixes #4392 --- diff --git a/toonz/sources/toonz/filmstripselection.cpp b/toonz/sources/toonz/filmstripselection.cpp index 1771c28..0cf7978 100644 --- a/toonz/sources/toonz/filmstripselection.cpp +++ b/toonz/sources/toonz/filmstripselection.cpp @@ -237,7 +237,10 @@ void TFilmstripSelection::cutFrames() { TXshSimpleLevel *sl = TApp::instance()->getCurrentLevel()->getSimpleLevel(); if (sl) { int firstSelectedIndex = sl->fid2index(*m_selectedFrames.begin()); - assert(firstSelectedIndex >= 0); + if(firstSelectedIndex < 0 || firstSelectedIndex > sl->getFrameCount()) { + selectNone(); + return; + } FilmstripCmd::cut(sl, m_selectedFrames); selectNone(); TFrameId fId = (firstSelectedIndex == 0)