validate empty topics
This commit is contained in:
parent
525a104976
commit
d1ac732b8c
|
@ -381,6 +381,10 @@ validate_packet(#mqtt_packet{ header = #mqtt_packet_header { type = ?UNSUBSCRIB
|
|||
validate_packet(_Packet) ->
|
||||
ok.
|
||||
|
||||
validate_topics(Type, []) when Type =:= subscribe orelse Type =:= unsubscribe ->
|
||||
lager:error("Empty Topics!"),
|
||||
{error, empty_topics};
|
||||
|
||||
validate_topics(Type, Topics) when Type =:= subscribe orelse Type =:= unsubscribe ->
|
||||
ErrTopics = [Topic || #mqtt_topic{name=Topic, qos=Qos} <- Topics,
|
||||
not (emqtt_topic:validate({Type, Topic}) and validate_qos(Qos))],
|
||||
|
|
Loading…
Reference in New Issue