plugins types BUGFIX handle NULL canonical value
diff --git a/src/common.h b/src/common.h
index 478c6d0..51fcbc9 100644
--- a/src/common.h
+++ b/src/common.h
@@ -18,6 +18,7 @@
#include <pthread.h>
#include <stddef.h>
#include <stdint.h>
+#include <string.h>
#include "context.h"
#include "hash_table.h"
@@ -371,6 +372,18 @@
int ly_strncmp(const char *refstr, const char *str, size_t str_len);
/**
+ * @brief Similar to strlen(3) but accepts NULL and returns 0.
+ *
+ * @param[in] s String to examine.
+ * @return Length of @p s.
+ */
+static inline size_t
+ly_strlen(const char *s)
+{
+ return s ? strlen(s) : 0;
+}
+
+/**
* @brief Get all possible value prefixes from an YANG value by iteratively returning specific substrings.
*
* The function looks for possible prefix ending in a colon at the beginning of @p str_begin.