liblog: fix an undefined-behavor in __write_to_log_daemon()

The behavior of passing NULL to c-string functions is undefined.

Test: passed clang-tidy checks
Bug: none

Change-Id: Ie7bcc43cd19bc4a1c314381af3929eae0a6154b9
diff --git a/liblog/logger_write.c b/liblog/logger_write.c
index 4324125..2599a53 100644
--- a/liblog/logger_write.c
+++ b/liblog/logger_write.c
@@ -343,7 +343,7 @@
             }
         }
         /* tag must be nul terminated */
-        if (strnlen(tag, len) >= len) {
+        if (tag && strnlen(tag, len) >= len) {
             tag = NULL;
         }