From: Youngjae Cho Date: Thu, 27 Jul 2023 07:19:16 +0000 (+0900) Subject: [Tizen.Log] Fix null reference exception X-Git-Tag: accepted/tizen/unified/20231205.024657~223 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e29cc74153d434b555b51c020338b31b1273347b;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [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 --- 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];