Skip to content

Commit

Permalink
Fix crash due to missing pointer validation
Browse files Browse the repository at this point in the history
Fix #6092
  • Loading branch information
nerzhul committed Jul 2, 2017
1 parent 94c294b commit 014a1a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/game.cpp
Expand Up @@ -121,8 +121,7 @@ struct TextDestPlayerInventory : public TextDest

struct LocalFormspecHandler : public TextDest
{
LocalFormspecHandler(const std::string &formname):
m_client(NULL)
LocalFormspecHandler(const std::string &formname)
{
m_formname = formname;
}
Expand Down Expand Up @@ -174,10 +173,11 @@ struct LocalFormspecHandler : public TextDest
}

// Don't disable this part when modding is disabled, it's used in builtin
m_client->getScript()->on_formspec_input(m_formname, fields);
if (m_client && m_client->getScript())
m_client->getScript()->on_formspec_input(m_formname, fields);
}

Client *m_client;
Client *m_client = nullptr;
};

/* Form update callback */
Expand Down

0 comments on commit 014a1a0

Please sign in to comment.