summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-01-24 07:44:22 +0800
committerGitHub <[email protected]>2021-01-24 07:44:22 +0800
commit46a2e685a2bd8a1986fdb83a19771f890035a524 (patch)
treec46c0543c1228f39a5250381c059acdb9be447a1
parente81f1a0eec95f02f44d6e69c1a5ce2b565cc2247 (diff)
parent43b1daf325a44c400dcc989a5560d4f93e8df202 (diff)
Merge pull request #4258 from Lawlieta/chenyong
[utilities][ulog] fix ulog backend color log length calculation error
-rw-r--r--components/utilities/ulog/ulog.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/components/utilities/ulog/ulog.c b/components/utilities/ulog/ulog.c
index 8be20ae115..5fcc40ac07 100644
--- a/components/utilities/ulog/ulog.c
+++ b/components/utilities/ulog/ulog.c
@@ -408,7 +408,11 @@ void ulog_output_to_all_backend(rt_uint32_t level, const char *tag, rt_bool_t is
else
{
/* recalculate the log start address and log size when backend not supported color */
- rt_size_t color_info_len = rt_strlen(color_output_info[level]), output_size = size;
+ rt_size_t color_info_len = 0, output_size = size;
+
+ if (color_output_info[level] != RT_NULL)
+ color_info_len = rt_strlen(color_output_info[level]);
+
if (color_info_len)
{
rt_size_t color_hdr_len = rt_strlen(CSI_START) + color_info_len;