diff options
author | Sadie Powell <sadie@witchery.services> | 2023-05-04 17:56:37 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2023-05-04 19:21:02 +0100 |
commit | b7abfe5eca076c29a0d49a411320612264093bdf (patch) | |
tree | a8c8adaa95b0aff200b3567677b3da548ebc020c /src/init.cpp | |
parent | 23e7f5bd338cbb78ab3d990ba58064726de42abc (diff) |
Avoid returning null when a config tag does not exist.
This invokes undefined behaviour on modern compilers.
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp index 025b34c4e..22f8385ee 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -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; |