Skip to content

Commit

Permalink
LibCpp: Don't include parameter type in FunctionType::to_string if null
Browse files Browse the repository at this point in the history
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
  • Loading branch information
itamar8910 authored and awesomekling committed Mar 5, 2022
1 parent 495a1be commit e9de381
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Userland/Libraries/LibCpp/AST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit e9de381

Please sign in to comment.