Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Avoid crash by testing pointer for actiongroup.

Wolthera van Hövell tot Westerflier2ed204d8652c
diff --git a/plugins/tools/svgtexttool/SvgTextTool.cpp b/plugins/tools/svgtexttool/SvgTextTool.cpp
index 673252a296..ad52a2277e 100644
--- a/plugins/tools/svgtexttool/SvgTextTool.cpp
+++ b/plugins/tools/svgtexttool/SvgTextTool.cpp
@@ -578,21 +578,27 @@ void SvgTextTool::slotTextTypeUpdated()
{
KoSvgTextShape *shape = selectedShape();
QActionGroup *typeConvertGroup = action("text_type_preformatted")->actionGroup();
- typeConvertGroup->setExclusive(true);
+ if (typeConvertGroup) {
+ typeConvertGroup->setExclusive(true);
+ }
Q_FOREACH (QAction *a, typeConvertGroup->actions()) {
a->setCheckable(true);
}
if (m_optionManager) {
if (shape) {
m_optionManager->convertToTextType(int(shape->textType()));
- typeConvertGroup->setEnabled(true);
+ if (typeConvertGroup) {
+ typeConvertGroup->setEnabled(true);
+ }
action("text_type_preformatted")->setChecked(shape->textType() == KoSvgTextShape::PreformattedText);
action("text_type_pre_positioned")->setChecked(shape->textType() == KoSvgTextShape::PrePositionedText);
action("text_type_inline_wrap")->setChecked(shape->textType() == KoSvgTextShape::InlineWrap);
} else {
m_optionManager->convertToTextType(-1);
- typeConvertGroup->setEnabled(false);
+ if (typeConvertGroup) {
+ typeConvertGroup->setEnabled(false);
+ }
}
const bool enableTypeSetting = (m_optionManager->typeSettingMode() && shape && (shape->textType() == KoSvgTextShape::PreformattedText ||shape->textType() == KoSvgTextShape::PrePositionedText));
action("svg_type_setting_move_selection_start_down_1_px")->actionGroup()->setEnabled(enableTypeSetting);