Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

fix brush undo crash

shun_iwasawac7aa6fbfb070
diff --git a/toonz/sources/tnztools/toolutils.cpp b/toonz/sources/tnztools/toolutils.cpp
index 2c73a3750..666da3702 100644
--- a/toonz/sources/tnztools/toolutils.cpp
+++ b/toonz/sources/tnztools/toolutils.cpp
@@ -1067,7 +1067,8 @@ void ToolUtils::UndoPencil::undo() const {
if (!stroke) return;
image->deleteStroke(stroke);
TSelection *selection = app->getCurrentSelection()->getSelection();
- if (StrokeSelection *strokeSelection = (StrokeSelection *)selection)
+ StrokeSelection *strokeSelection = dynamic_cast<StrokeSelection *>(selection);
+ if (strokeSelection)
strokeSelection->selectNone();
UINT size = m_fillInformation->size();