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
This commit is contained in:
Itamar 2022-03-05 16:11:03 +02:00 committed by Andreas Kling
parent 495a1be925
commit e9de381607

View file

@ -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());