Skip to content

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

C

Fix toonz raster brush style update crash (#2517)

manongjohnb5dd396b498e
diff --git a/toonz/sources/tnztools/toonzrasterbrushtool.cpp b/toonz/sources/tnztools/toonzrasterbrushtool.cpp
index b63222161..3bf9d7da5 100644
--- a/toonz/sources/tnztools/toonzrasterbrushtool.cpp
+++ b/toonz/sources/tnztools/toonzrasterbrushtool.cpp
@@ -2081,6 +2081,11 @@ void ToonzRasterBrushTool::updateCurrentStyle() {
TTool::Application *app = TTool::getApplication();
TMyPaintBrushStyle *brushStyle =
dynamic_cast<TMyPaintBrushStyle *>(app->getCurrentLevelStyle());
+ if (!brushStyle) {
+ // brush changed to normal abnormally. Complete color style change.
+ onColorStyleChanged();
+ return;
+ }
double radiusLog = brushStyle->getBrush().getBaseValue(
MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC) +
m_modifierSize.getValue() * log(2.0);