aboutsummaryrefslogtreecommitdiff
path: root/src/jid.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jid.erl')
-rw-r--r--src/jid.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/jid.erl b/src/jid.erl
index cc387ecbe..7bdd652ae 100644
--- a/src/jid.erl
+++ b/src/jid.erl
@@ -87,9 +87,13 @@ split(#jid{user = U, server = S, resource = R}) ->
split(_) ->
error.
--spec from_string(binary()) -> jid() | error.
-
-from_string(S) ->
+-spec from_string([binary()|string()]) -> jid() | error.
+from_string(S) when is_list(S) ->
+ %% We do not accept list because we want to enforce good practice of
+ %% using binaries for string. However, we do not let it crash to avoid
+ %% losing associated ets table.
+ {error, need_jid_as_binary};
+from_string(S) when is_binary(S) ->
SplitPattern = ets:lookup_element(jlib, string_to_jid_pattern, 2),
Size = size(S),
End = Size-1,