1
0
mirror of https://github.com/anope/anope.git synced 2026-06-28 07:36:37 +02:00

Avoid returning null when a config tag does not exist.

This invokes undefined behaviour on modern compilers.
This commit is contained in:
Sadie Powell
2023-05-04 17:56:37 +01:00
parent 23e7f5bd33
commit b7abfe5eca
3 changed files with 9 additions and 6 deletions
+2 -2
View File
@@ -427,8 +427,8 @@ void Anope::Init(int ac, char **av)
if (!getuid() && !getgid())
{
/* If we are configured to setuid later, don't issue a warning */
Configuration::Block *options = Config->GetBlock("options");
if (options->Get<const Anope::string>("user").empty())
Configuration::Block *options = Config ? Config->GetBlock("options") : NULL;
if (!options || options->Get<const Anope::string>("user").empty())
{
std::cerr << "WARNING: You are currently running Anope as the root superuser. Anope does not" << std::endl;
std::cerr << " require root privileges to run, and it is discouraged that you run Anope" << std::endl;