summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextformat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qtextformat.cpp')
-rw-r--r--src/gui/text/qtextformat.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index a3dd83e..7f82365 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -3041,12 +3041,18 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format)
int idx = formats.size();
formats.append(format);
- QTextFormat &f = formats.last();
- if (!f.d)
- f.d = new QTextFormatPrivate;
- f.d->resolveFont(defaultFnt);
+ QT_TRY{
+ QTextFormat &f = formats.last();
+ if (!f.d)
+ f.d = new QTextFormatPrivate;
+ f.d->resolveFont(defaultFnt);
- hashes.insert(hash);
+ hashes.insert(hash);
+
+ } QT_CATCH(...) {
+ formats.pop_back();
+ QT_RETHROW;
+ }
return idx;
}