Skip to content

Add a missing check for nullptr #8710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions lldb/source/Expression/UserExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ UserExpression::Evaluate(ExecutionContext &exe_ctx,
target->GetUserExpressionForLanguage(
fixed_expression->c_str(), full_prefix, language, desired_type,
options, ctx_obj, error));
if (!fixed_expression_sp)
break;
DiagnosticManager fixed_diagnostic_manager;
parse_success = fixed_expression_sp->Parse(
fixed_diagnostic_manager, exe_ctx, execution_policy,
Expand All @@ -318,17 +320,16 @@ UserExpression::Evaluate(ExecutionContext &exe_ctx,
diagnostic_manager.Clear();
user_expression_sp = fixed_expression_sp;
break;
}
// The fixed expression also didn't parse. Let's check for any new
// fixits we could try.
if (!fixed_expression_sp->GetFixedText().empty()) {
*fixed_expression = fixed_expression_sp->GetFixedText().str();
} else {
// The fixed expression also didn't parse. Let's check for any new
// Fix-Its we could try.
if (!fixed_expression_sp->GetFixedText().empty()) {
*fixed_expression = fixed_expression_sp->GetFixedText().str();
} else {
// Fixed expression didn't compile without a fixit, don't retry and
// don't tell the user about it.
fixed_expression->clear();
break;
}
// Fixed expression didn't compile without a fixit, don't retry and
// don't tell the user about it.
fixed_expression->clear();
break;
}
}
}
Expand Down