mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-02 15:55:30 +00:00
Fix crash when giving commandline arguments with no console initialized
This commit is contained in:
parent
a4f07c9a4d
commit
beaea4f624
@ -369,10 +369,6 @@ TConsole::TConsole() {
|
||||
mCommandline.set_history_limit(20);
|
||||
mCommandline.set_prompt("> ");
|
||||
BackupOldLog();
|
||||
bool success = mCommandline.enable_write_to_file("Server.log");
|
||||
if (!success) {
|
||||
beammp_error("unable to open file for writing: \"Server.log\"");
|
||||
}
|
||||
mCommandline.on_command = [this](Commandline& c) {
|
||||
try {
|
||||
auto cmd = c.get_command();
|
||||
|
@ -77,6 +77,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
int BeamMPServerMain(MainArguments Arguments) {
|
||||
setlocale(LC_ALL, "C");
|
||||
Application::InitializeConsole();
|
||||
ArgsParser Parser;
|
||||
Parser.RegisterArgument({ "help" }, ArgsParser::NONE);
|
||||
Parser.RegisterArgument({ "version" }, ArgsParser::NONE);
|
||||
@ -116,9 +117,12 @@ int BeamMPServerMain(MainArguments Arguments) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Application::InitializeConsole();
|
||||
|
||||
Application::SetSubsystemStatus("Main", Application::Status::Starting);
|
||||
bool Success = Application::Console().Internal().enable_write_to_file("Server.log");
|
||||
if (!Success) {
|
||||
beammp_error("unable to open file for writing: \"Server.log\"");
|
||||
}
|
||||
|
||||
SetupSignalHandlers();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user