Index: lldb/include/lldb/Expression/DiagnosticManager.h =================================================================== --- lldb/include/lldb/Expression/DiagnosticManager.h +++ lldb/include/lldb/Expression/DiagnosticManager.h @@ -114,7 +114,8 @@ } void AddDiagnostic(std::unique_ptr diagnostic) { - m_diagnostics.push_back(std::move(diagnostic)); + if (diagnostic) + m_diagnostics.push_back(std::move(diagnostic)); } size_t Printf(DiagnosticSeverity severity, const char *format, ...) Index: lldb/unittests/Expression/DiagnosticManagerTest.cpp =================================================================== --- lldb/unittests/Expression/DiagnosticManagerTest.cpp +++ lldb/unittests/Expression/DiagnosticManagerTest.cpp @@ -75,6 +75,9 @@ TEST(DiagnosticManagerTest, GetStringNoDiags) { DiagnosticManager mgr; EXPECT_EQ("", mgr.GetString()); + std::unique_ptr empty; + mgr.AddDiagnostic(std::move(empty)); + EXPECT_EQ("", mgr.GetString()); } TEST(DiagnosticManagerTest, GetStringBasic) {