Skip to content

Commit e65d102

Browse files
change to process correctly
1 parent 7405353 commit e65d102

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/myxql/protocol/types.ex

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,13 @@ defmodule MyXQL.Protocol.Types do
7070

7171
def take_string_nul(""), do: {nil, ""}
7272

73-
def take_string_nul(binary) do
74-
[string, rest] = :binary.split(binary, <<0>>)
75-
{string, rest}
73+
def take_string_nul(binary) when is_binary(binary) do
74+
case :binary.split(binary, <<0>>) do
75+
[string] ->
76+
{string, ""}
77+
78+
[string, rest] ->
79+
{string, rest}
80+
end
7681
end
7782
end

0 commit comments

Comments
 (0)