diff --git a/ChangeLog.txt b/ChangeLog.txt index 0eea6fe6f5..52a76e44b0 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,7 @@ pre-2.0.2 - harden delete unused styles to trailing whitespace in class names - fix unrecognized media-types application/xml and text/xml - fix cursor just before end tag bug in align justiry, centre, right + - fix crash when all metadata removed by user in MetaEditor Sigil-2.0.1 diff --git a/src/Dialogs/MetaEditor.cpp b/src/Dialogs/MetaEditor.cpp index ecc16919ad..c9adf1db9e 100644 --- a/src/Dialogs/MetaEditor.cpp +++ b/src/Dialogs/MetaEditor.cpp @@ -40,6 +40,13 @@ #include "Dialogs/MetaEditorItemDelegate.h" #include "Dialogs/MetaEditor.h" +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + #define QT_ENUM_SKIPEMPTYPARTS Qt::SkipEmptyParts + #define QT_ENUM_KEEPEMPTYPARTS Qt::KeepEmptyParts +#else + #define QT_ENUM_SKIPEMPTYPARTS QString::SkipEmptyParts + #define QT_ENUM_KEEPEMPTYPARTS QString::KeepEmptyParts +#endif static const QString SETTINGS_GROUP = "meta_editor"; static const QString _IN = " "; @@ -303,7 +310,7 @@ QString MetaEditor::SetNewOPFMetadata(QString& data) QString newopfdata = m_opfdata; MetadataPieces mdp; // Translate from Human Readable Form - QStringList dlist = data.split(_RS); + QStringList dlist = data.split(_RS, QT_ENUM_SKIPEMPTYPARTS); QStringList nlist; foreach(QString rc, dlist) { if (rc.startsWith(_IN)) {