diff --git a/contrib/tsearch/morph.c b/contrib/tsearch/morph.c
index 4394448737d3e4319727385594265f5e5d413671..3acbef986231e8b198bf1845bf4100b976e66cdc 100644
--- a/contrib/tsearch/morph.c
+++ b/contrib/tsearch/morph.c
@@ -173,6 +173,10 @@ lemmatize(char *word, int *len, int type)
 			/* word is stopword */
 			return NULL;
 		}
+		else if (nd == BYLOCALE)
+		{
+			continue; /* no dict for current locale */
+		}
 		else
 		{
 			dict = &dicts[nd];