Skip to content

Commit 744859e

Browse files
benfalkJosé Valim
authored andcommitted
Generate error for no pid given to Genserver.reply (#4876)
Prior to this change it is possible to send any two-pair tuple to `GenServer.reply/2` and it will happily return `:ok`, catching any errors. This leads to some hard to track-down bugs if you pass it the wrong term. Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
1 parent 4596baa commit 744859e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/elixir/lib/gen_server.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ defmodule GenServer do
746746
@spec reply(from, term) :: :ok
747747
def reply(client, reply)
748748

749-
def reply({to, tag}, reply) do
749+
def reply({to, tag}, reply) when is_pid(to) do
750750
try do
751751
send(to, {tag, reply})
752752
:ok

0 commit comments

Comments
 (0)