diff --git a/src/syntax/katehighlight.cpp b/src/syntax/katehighlight.cpp --- a/src/syntax/katehighlight.cpp +++ b/src/syntax/katehighlight.cpp @@ -115,6 +115,15 @@ */ auto definitions = definition().includedDefinitions(); + // it's possible to not have any defintions with malformed file + if (definitions.isEmpty()) { + m_properties.resize(1); + m_propertiesForFormat.push_back(&m_properties[0]); + m_formats.resize(1); + m_formatsIdToIndex.insert(std::make_pair(m_formats[0].id(), 0)); + return; + } + /** * first: handle only really included definitions */ @@ -251,7 +260,9 @@ { // WE ATM assume ascending offset order Q_ASSERT(m_textLineToHighlight); - Q_ASSERT(format.isValid()); + if (!format.isValid()) { + return; + } // get internal attribute, must exist const auto it = m_formatsIdToIndex.find(format.id());