Skip to content

Commit 4cb7a6e

Browse files
committed
Синхронизация Utils. Устранено падение при вызове DLog для обычных строк (без форматирования). Это связано с тем, что std::vformat кидает исключение для некорректной форматной строки. Примеры: DLog("{_"); DLog("{");.
1 parent 9c76706 commit 4cb7a6e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Source/Utils/Util.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,21 @@
99
template <typename... Args>
1010
inline void DebugLogFmt(std::wstring_view format, Args&& ...args)
1111
{
12-
DbgLogInfo(LOG_TRACE, 3, std::vformat(format, std::make_wformat_args(args...)).c_str());
12+
if (sizeof...(Args)) {
13+
DbgLogInfo(LOG_TRACE, 3, std::vformat(format, std::make_wformat_args(args...)).c_str());
14+
} else {
15+
DbgLogInfo(LOG_TRACE, 3, format.data());
16+
}
1317
}
1418

1519
template <typename... Args>
1620
inline void DebugLogFmt(std::string_view format, Args&& ...args)
1721
{
18-
DbgLogInfo(LOG_TRACE, 3, std::vformat(format, std::make_format_args(args...)).c_str());
22+
if (sizeof...(Args)) {
23+
DbgLogInfo(LOG_TRACE, 3, std::vformat(format, std::make_format_args(args...)).c_str());
24+
} else {
25+
DbgLogInfo(LOG_TRACE, 3, format.data());
26+
}
1927
}
2028

2129
#ifdef _DEBUG

0 commit comments

Comments
 (0)