summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2017-07-02 22:26:25 +0200
committerLoic Blot <loic.blot@unix-experience.fr>2017-07-02 22:26:25 +0200
commit014a1a08051004cbaecc7f42467cf0509021146d (patch)
tree81005b6a7e0bec4dc2df071bcea4ee9da403c3b7 /src/game.cpp
parent94c294bfdcfb7caa84c88649f3630605ed90e884 (diff)
downloadminetest-014a1a08051004cbaecc7f42467cf0509021146d.tar.gz
minetest-014a1a08051004cbaecc7f42467cf0509021146d.tar.bz2
minetest-014a1a08051004cbaecc7f42467cf0509021146d.zip
Fix crash due to missing pointer validation
Fix #6092
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 827512fbc..9f7b0ca52 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -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;
}
@@ -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 */