NeighborCommands: convert assertion to runtime check

This commit is contained in:
Max Kellermann 2014-01-26 01:17:49 +01:00
parent 5c4a42caa0
commit 642be502c0

View File

@ -41,7 +41,11 @@ CommandResult
handle_listneighbors(Client &client,
gcc_unused int argc, gcc_unused char *argv[])
{
assert(instance->neighbors != nullptr);
if (instance->neighbors == nullptr) {
command_error(client, ACK_ERROR_UNKNOWN,
"No neighbor plugin configured");
return CommandResult::ERROR;
}
const auto neighbors = instance->neighbors->GetList();
for (const auto &i : neighbors)