Skip to content

Commit

Permalink
Fix crash in opermotd caused by reading config prior to init
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel De Graaf committed Aug 21, 2010
1 parent 806cc38 commit 2377080
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/modules/m_opermotd.cpp
Expand Up @@ -63,17 +63,16 @@ class ModuleOpermotd : public Module

void LoadOperMOTD()
{
ConfigTag* conf = ServerInstance->Config->ConfValue("opermotd");
opermotd->LoadFile(conf->getString("file","opermotd"));
onoper = conf->getBool("onoper", true);
}

ModuleOpermotd() : cmd(this) {}
ModuleOpermotd() : cmd(this)
{
opermotd = new FileReader;
}

void init()
{
ServerInstance->AddCommand(&cmd);
opermotd = new FileReader;
LoadOperMOTD();
Implementation eventlist[] = { I_OnOper };
ServerInstance->Modules->Attach(eventlist, this, 1);
Expand All @@ -96,9 +95,11 @@ class ModuleOpermotd : public Module
ShowOperMOTD(user);
}

void ReadConfig(ConfigReadStatus&)
void ReadConfig(ConfigReadStatus& status)
{
LoadOperMOTD();
ConfigTag* conf = status.GetTag("opermotd");
opermotd->LoadFile(conf->getString("file","opermotd"));
onoper = conf->getBool("onoper", true);
}
};

Expand Down

0 comments on commit 2377080

Please sign in to comment.