diff --git a/lib/rdf/literal/datatypes/lang_string.ex b/lib/rdf/literal/datatypes/lang_string.ex index 88c0584..063b48b 100644 --- a/lib/rdf/literal/datatypes/lang_string.ex +++ b/lib/rdf/literal/datatypes/lang_string.ex @@ -126,7 +126,7 @@ defmodule RDF.LangString do do: match_language?(language_tag, language_range) def match_language?("", "*"), do: false - def match_language?(_, "*"), do: true + def match_language?(str, "*") when is_binary(str), do: true def match_language?(language_tag, language_range) when is_binary(language_tag) and is_binary(language_range) do diff --git a/test/unit/datatypes/lang_string_test.exs b/test/unit/datatypes/lang_string_test.exs index c3a6b49..ae142b3 100644 --- a/test/unit/datatypes/lang_string_test.exs +++ b/test/unit/datatypes/lang_string_test.exs @@ -291,6 +291,7 @@ defmodule RDF.LangStringTest do test "with a non-language-tagged literal" do refute XSD.String.new("42") |> LangString.match_language?("de") refute XSD.String.new("42") |> LangString.match_language?("") + refute XSD.String.new("42") |> LangString.match_language?("*") refute XSD.Integer.new("42") |> LangString.match_language?("de") end end