Fix segv on uninitialized command fields.

This commit is contained in:
2026-08-30 13:08:48 +01:00
parent e19a8e6bba
commit 87d9148b82
2 changed files with 5 additions and 4 deletions
+3 -3
View File
@@ -65,10 +65,10 @@ struct AddressPromise {
struct Command { struct Command {
bool temp_address{false}; bool temp_address{false};
std::vector<AddressPromise> addresses{}; std::vector<AddressPromise> addresses{};
functions::Function *function; functions::Function *function{nullptr};
functions::Function::Argument argument; functions::Function::Argument argument{std::monostate()};
std::vector<AddressPromise> argument_addresses{}; std::vector<AddressPromise> argument_addresses{};
functions::Suffix *suffix; functions::Suffix *suffix{nullptr};
}; };
struct CompletionContext { struct CompletionContext {
+2 -1
View File
@@ -124,7 +124,8 @@ void BEd::handle(std::string_view cmd, bool eof) {
throw ed_error("Line number can't be zero."); throw ed_error("Line number can't be zero.");
} }
} }
c.function->handle(*this, address, nullptr, c.argument, nullptr); if (c.function->handle)
c.function->handle(*this, address, nullptr, c.argument, nullptr);
if (c.suffix) if (c.suffix)
c.suffix->handle(*this); c.suffix->handle(*this);
if (c.temp_address) if (c.temp_address)