From e29cc74153d434b555b51c020338b31b1273347b Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Thu, 27 Jul 2023 16:19:16 +0900 Subject: [PATCH] [Tizen.Log] Fix null reference exception When a null string comes, replace it with empty string so that not to throw null reference exception. Signed-off-by: Youngjae Cho --- src/Tizen.Log/Tizen/Log.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Tizen.Log/Tizen/Log.cs b/src/Tizen.Log/Tizen/Log.cs index 74888fe..1e1c645 100755 --- a/src/Tizen.Log/Tizen/Log.cs +++ b/src/Tizen.Log/Tizen/Log.cs @@ -30,6 +30,15 @@ namespace Tizen private static unsafe void _Print(Interop.Dlog.LogID log_id, Interop.Dlog.LogPriority priority, string tag, string message, string file, string func, int line) { + if (tag == null) + tag = String.Empty; + if (message == null) + message = String.Empty; + if (file == null) + file = String.Empty; + if (func == null) + func = String.Empty; + int tagByteLength = Encoding.UTF8.GetMaxByteCount(tag.Length); Span tagByte = tagByteLength < 1024 ? stackalloc byte[tagByteLength + 1] : new byte[tagByteLength + 1]; -- 2.7.4