diff --git a/src/plugins/clangformat/clangformatbaseindenter.cpp b/src/plugins/clangformat/clangformatbaseindenter.cpp index cf48f4d61b5..7b4549a9b41 100644 --- a/src/plugins/clangformat/clangformatbaseindenter.cpp +++ b/src/plugins/clangformat/clangformatbaseindenter.cpp @@ -930,8 +930,14 @@ clang::format::FormatStyle ClangFormatBaseIndenterPrivate::customSettingsStyle( return currentQtStyle(preferences); clang::format::FormatStyle currentSettingsStyle; - const Utils::expected_str success = parseConfigurationFile(filePath, currentSettingsStyle); - QTC_ASSERT(success, return currentQtStyle(preferences)); + const Utils::expected_str result = parseConfigurationFile(filePath, currentSettingsStyle); + if (!result) { + qCWarning(clangIndenterLog) + << QString{"Failed to parse config %1. Falling back to the Qt style."}.arg( + filePath.toUserOutput()) + << result.error(); + return currentQtStyle(preferences); + }; return currentSettingsStyle; } diff --git a/src/plugins/clangformat/clangformatconfigwidget.cpp b/src/plugins/clangformat/clangformatconfigwidget.cpp index 56a51ef83de..9d65daadcee 100644 --- a/src/plugins/clangformat/clangformatconfigwidget.cpp +++ b/src/plugins/clangformat/clangformatconfigwidget.cpp @@ -201,7 +201,7 @@ void ClangFormatConfigWidget::initEditor() this); connect(m_editor->document(), &TextEditor::TextDocument::contentsChanged, this, [this] { - clang::format::FormatStyle currentSettingsStyle; + clang::format::FormatStyle currentSettingsStyle{}; const Utils::expected_str success = parseConfigurationContent(m_editor->document()->contents().toStdString(), currentSettingsStyle);