mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
added fix for crash when there is no datadir
This commit is contained in:
parent
665205327d
commit
4a365d41b6
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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]);
|
||||
|
|
Loading…
Reference in a new issue