mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
Fix server crashing on Lua errors
Previously, the server called FATAL_ERROR when a Lua error occured. This caused a (mostly useless) core dump. The server now simply throws an exception, which is caught and printed before exiting with a non-zero return value. This also fixes a number of instances where errors were logged multiple times.
This commit is contained in:
@@ -238,13 +238,13 @@ bool GUIEngine::loadMainMenuScript()
|
||||
}
|
||||
|
||||
std::string script = porting::path_share + DIR_DELIM "builtin" + DIR_DELIM "init.lua";
|
||||
if (m_script->loadScript(script)) {
|
||||
try {
|
||||
m_script->loadScript(script);
|
||||
// Menu script loaded
|
||||
return true;
|
||||
} else {
|
||||
infostream
|
||||
<< "GUIEngine: execution of menu script in: \""
|
||||
<< m_scriptdir << "\" failed!" << std::endl;
|
||||
} catch (const ModError &e) {
|
||||
errorstream << "GUIEngine: execution of menu script failed: "
|
||||
<< e.what() << std::endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user