1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Don't crash if a Lua error occurs inside get_staticdata

This commit is contained in:
Gregor Parzefall 2023-07-03 20:34:02 +02:00 committed by GitHub
parent d71872af23
commit 26453df2f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 17 deletions

View file

@ -150,7 +150,7 @@ public:
Address bind_addr,
bool dedicated,
ChatInterface *iface = nullptr,
std::string *on_shutdown_errmsg = nullptr
std::string *shutdown_errmsg = nullptr
);
~Server();
DISABLE_CLASS_COPY(Server);
@ -300,6 +300,9 @@ public:
setAsyncFatalError(std::string("Lua: ") + e.what());
}
// Not thread-safe.
void addShutdownError(const ModError &e);
bool showFormspec(const char *name, const std::string &formspec, const std::string &formname);
Map & getMap() { return m_env->getMap(); }
ServerEnvironment & getEnv() { return *m_env; }
@ -655,9 +658,9 @@ private:
ChatInterface *m_admin_chat;
std::string m_admin_nick;
// if a mod-error occurs in the on_shutdown callback, the error message will
// be written into this
std::string *const m_on_shutdown_errmsg;
// If a mod error occurs while shutting down, the error message will be
// written into this.
std::string *const m_shutdown_errmsg;
/*
Map edit event queue. Automatically receives all map edits.