File 0031-turtle_publisher-add-guards-to-mk_publish-5.patch of Package turtle
From 1e04ffe7cc2376fd34777b58edac3b7ae1ec018a Mon Sep 17 00:00:00 2001
From: Led <ledest@gmail.com>
Date: Wed, 19 Jun 2019 12:41:53 +0300
Subject: [PATCH 1/3] turtle_publisher: add guards to mk_publish/5
---
src/turtle_publisher.erl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/turtle_publisher.erl b/src/turtle_publisher.erl
index 1e71c45..78d2698 100644
--- a/src/turtle_publisher.erl
+++ b/src/turtle_publisher.erl
@@ -352,7 +352,8 @@ properties(ContentType, #{}) ->
#'P_basic' { content_type = ContentType }.
%% Create a new publish package
-mk_publish(Exch, Key, ContentType, IODataPayload, Opts) ->
+mk_publish(Exch, Key, ContentType, IODataPayload, Opts) when is_binary(Exch), is_binary(Key),
+ ContentType =:= undefined orelse is_binary(ContentType) ->
Pub = #'basic.publish' {
exchange = Exch,
routing_key = Key
--
2.16.4