When logging don't use `core.status_view` if not yet initialized

This commit is contained in:
Guldoman 2023-06-09 03:50:34 +02:00 committed by takase1121
parent 3febcf454c
commit ff884d7d4a
No known key found for this signature in database
GPG Key ID: 60EEFFC68EB3031B
1 changed files with 3 additions and 1 deletions

View File

@ -1162,8 +1162,10 @@ function core.custom_log(level, show, backtrace, fmt, ...)
local text = string.format(fmt, ...) local text = string.format(fmt, ...)
if show then if show then
local s = style.log[level] local s = style.log[level]
if core.status_view then
core.status_view:show_message(s.icon, s.color, text) core.status_view:show_message(s.icon, s.color, text)
end end
end
local info = debug.getinfo(2, "Sl") local info = debug.getinfo(2, "Sl")
local at = string.format("%s:%d", info.short_src, info.currentline) local at = string.format("%s:%d", info.short_src, info.currentline)