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++

Fix crash when switching styles with variable font.

Wolthera van Hövell tot Westerflier8d30c3c61035
diff --git a/plugins/dockers/textproperties/FontAxesModel.cpp b/plugins/dockers/textproperties/FontAxesModel.cpp
index 99fedf988f..c46c97c02e 100644
--- a/plugins/dockers/textproperties/FontAxesModel.cpp
+++ b/plugins/dockers/textproperties/FontAxesModel.cpp
@@ -156,5 +156,11 @@ void FontAxesModel::setAxisValues(const QVariantHash &newAxisValues)
return;
d->axisValues = newAxisValues;
emit axisValuesChanged();
- emit dataChanged(index(0, 0, QModelIndex()), index(d->axes.size()-1, 0, QModelIndex()), {Qt::EditRole});
+ if (!d->axes.isEmpty()) {
+ QModelIndex idx1 = index(0, 0, QModelIndex());
+ QModelIndex idx2 = index(d->axes.size()-1, 0, QModelIndex());
+ if (idx1.isValid() && idx2.isValid()) {
+ emit dataChanged(idx1, idx2, {Qt::EditRole});
+ }
+ }
}