added fix for crash when there is no datadir

This commit is contained in:
oy 2010-08-05 20:34:16 +02:00
parent 665205327d
commit 4a365d41b6
3 changed files with 9 additions and 3 deletions

View file

@ -45,6 +45,12 @@ public:
virtual bool RegisterInterfaceImpl(const char *pName, IInterface *pInterface)
{
// TODO: More error checks here
if(!pInterface)
{
dbg_msg("kernel", "ERROR: couldn't register interface %s. null pointer given", pName);
return false;
}
if(m_NumInterfaces == MAX_INTERFACES)
{
dbg_msg("kernel", "ERROR: couldn't register interface '%s'. maximum of interfaces reached", pName);
@ -53,7 +59,7 @@ public:
if(FindInterfaceInfo(pName) != 0)
{
dbg_msg("kernel", "ERROR: couldn't register interface '%s'. interface already exists");
dbg_msg("kernel", "ERROR: couldn't register interface '%s'. interface already exists", pName);
return false;
}

View file

@ -197,7 +197,7 @@ public:
static IStorage *Create(const char *pApplicationName, int NumArgs, const char **ppArguments)
{
CStorage *p = new CStorage();
if(p->Init(pApplicationName, NumArgs, ppArguments))
if(p && p->Init(pApplicationName, NumArgs, ppArguments))
{
delete p;
p = 0;

View file

@ -12,7 +12,7 @@ int main(int argc, const char **argv)
CDataFileReader DataFile;
CDataFileWriter df;
if(argc != 3)
if(!pStorage || argc != 3)
return -1;
str_format(aFileName, sizeof(aFileName), "maps/%s", argv[2]);