parser BUGFIX forbid empty patterns

Refs sysrepo/sysrepo#2572
diff --git a/src/parser_yang.c b/src/parser_yang.c
index d6481d4..beedbf1 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -585,6 +585,10 @@
                 (*flags) |= ctx->in->current[0] == '\'' ? LYS_SINGLEQUOTED : LYS_DOUBLEQUOTED;
             }
             LY_CHECK_GOTO(ret = read_qstring(ctx, arg, word_p, word_b, word_len, &buf_len), error);
+            if (!*word_p) {
+                /* do not return NULL word */
+                *word_p = "";
+            }
             goto str_end;
         case '/':
             if (ctx->in->current[1] == '/') {
@@ -2053,6 +2057,12 @@
     /* get value */
     LY_CHECK_RET(get_argument(ctx, Y_STR_ARG, NULL, &word, &buf, &word_len));
 
+    /* empty pattern is not valid */
+    if (!strlen(word)) {
+        LOGVAL_PARSER(ctx, LY_VCODE_INVAL, word_len, word, "pattern");
+        return LY_EVALID;
+    }
+
     /* add special meaning first byte */
     if (buf) {
         buf = ly_realloc(buf, word_len + 2);