Only close connection if it is not nil
This commit is contained in:
parent
123093a186
commit
d0ee899ab9
1 changed files with 5 additions and 1 deletions
|
@ -84,7 +84,11 @@ def handle_call({:bind_user, name, password}, from, state) do
|
|||
|
||||
@impl true
|
||||
def terminate(_, state) do
|
||||
:eldap.close(state[:connection])
|
||||
connection = Keyword.get(state, :connection)
|
||||
|
||||
if not is_nil(connection) do
|
||||
:eldap.close(connection)
|
||||
end
|
||||
|
||||
:ok
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue