Pārlūkot izejas kodu

LibCpp: Don't include parameter type in FunctionType::to_string if null

The type of a function parameter can be null if we failed to parse it.
In such a case, calling to_string() on a FunctionType node used to cause
a null dereference.

This caused the language server to crash when processing
AK/StdLibExtraDetails.h
Itamar 3 gadi atpakaļ
vecāks
revīzija
e9de381607
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. 2 1
      Userland/Libraries/LibCpp/AST.cpp

+ 2 - 1
Userland/Libraries/LibCpp/AST.cpp

@@ -124,7 +124,8 @@ String FunctionType::to_string() const
             first = false;
         else
             builder.append(", ");
-        builder.append(parameter.type()->to_string());
+        if (parameter.type())
+            builder.append(parameter.type()->to_string());
         if (parameter.name() && !parameter.full_name().is_empty()) {
             builder.append(" ");
             builder.append(parameter.full_name());