Skip to content

Commit ae0b2b5

Browse files
committed
fix(logger): Crash
1 parent 5ef09fe commit ae0b2b5

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

PackageScript

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripti
6161

6262
configs_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'configs'))
6363
configs_plugins_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'configs', 'plugins'))
64+
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'configs', 'addons.json'), configs_folder)
6465
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'configs', 'core.json'), configs_folder)
6566
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'configs', 'console_filter.json'), configs_folder)
6667
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'configs', 'databases.json'), configs_folder)

src/utils/utils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ bool starts_with(std::string value, std::string starting)
167167
void PLUGIN_PRINT(std::string category, std::string str)
168168
{
169169
g_SMAPI->ConPrint((PREFIX " " + GetTerminalStringColor(category) + "[" + category + "]\e[39m " + str).c_str());
170-
if (g_Config) {
171-
if (g_Config->FetchValue<bool>("core.logging.save_core_messages")) {
170+
if (g_Config && g_Config->FetchValue<bool>("core.logging.save_core_messages")) {
171+
if (g_Logger && g_Logger->FetchLogger("core")) {
172172
str.pop_back();
173173
g_Logger->FetchLogger("core")->WriteLog(LogType_t::Common, "[" + category + "] " + str);
174174
}
@@ -185,8 +185,8 @@ void PLUGIN_PRINTF(std::string category, std::string str, ...)
185185
va_end(ap);
186186

187187
g_SMAPI->ConPrint((PREFIX " " + GetTerminalStringColor(category) + "[" + category + "]\e[39m " + std::string(buffer)).c_str());
188-
if (g_Config) {
189-
if (g_Config->FetchValue<bool>("core.logging.save_core_messages")) {
188+
if (g_Config && g_Config->FetchValue<bool>("core.logging.save_core_messages")) {
189+
if (g_Logger && g_Logger->FetchLogger("core")) {
190190
std::string buf = buffer;
191191
buf.pop_back();
192192
g_Logger->FetchLogger("core")->WriteLog(LogType_t::Common, "[" + category + "] " + buf);

0 commit comments

Comments
 (0)