diff --git a/src/ulib/log/logger.cpp b/src/ulib/log/logger.cpp index 5b29295..f6f9040 100644 --- a/src/ulib/log/logger.cpp +++ b/src/ulib/log/logger.cpp @@ -28,7 +28,7 @@ Logger::Log(int32_t level, const char *file, const char *func, int32_t line, con std::string pattern = "[{}] {}:{}@{} msg: {}"; // auto add CR - bool need_append_line_break = !msg || msg[strlen(msg) - 1] != '\n'; + bool need_append_line_break = !msg || *msg == '\0' || msg[strlen(msg) - 1] != '\n'; if (need_append_line_break) { pattern.append(1, '\n'); }