Skip to content

Commit af61e93

Browse files
committed
Protect ets:lookup_element/4 in try catch
See #11667 (comment) for rationale.
1 parent 63313e1 commit af61e93

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

deps/rabbit/src/rabbit_db_binding.erl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,8 +708,15 @@ match_routing_key_in_mnesia(SrcName, RoutingKeys, UseIndex) ->
708708
end.
709709

710710
match_routing_key_in_khepri(Src, ['_']) ->
711-
ets:lookup_element(?KHEPRI_ROUTE_BY_SOURCE_PROJECTION,
712-
Src, #route_by_source.destination, []);
711+
try
712+
ets:lookup_element(?KHEPRI_ROUTE_BY_SOURCE_PROJECTION,
713+
Src,
714+
#route_by_source.destination,
715+
[])
716+
catch
717+
error:badarg ->
718+
[]
719+
end;
713720
match_routing_key_in_khepri(Src, RoutingKeys) ->
714721
lists:foldl(
715722
fun(RK, Acc) ->

0 commit comments

Comments
 (0)