Skip to content

Commit 014a1a0

Browse files
committedJul 2, 2017
Fix crash due to missing pointer validation
Fix #6092
1 parent 94c294b commit 014a1a0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎src/game.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ struct TextDestPlayerInventory : public TextDest
121121

122122
struct LocalFormspecHandler : public TextDest
123123
{
124-
LocalFormspecHandler(const std::string &formname):
125-
m_client(NULL)
124+
LocalFormspecHandler(const std::string &formname)
126125
{
127126
m_formname = formname;
128127
}
@@ -174,10 +173,11 @@ struct LocalFormspecHandler : public TextDest
174173
}
175174

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

180-
Client *m_client;
180+
Client *m_client = nullptr;
181181
};
182182

183183
/* Form update callback */

0 commit comments

Comments
 (0)
Please sign in to comment.