@@ -181,12 +181,14 @@ fn process_stmt_condition(
181181 // "match-prefix-set"
182182 PolicyCondition :: MatchPrefixSet ( value) => {
183183 let af = prefix. address_family ( ) ;
184- let set = match_sets. prefixes . get ( & ( value. clone ( ) , af) ) . unwrap ( ) ;
185- set. prefixes . iter ( ) . any ( |range| {
186- prefix. ip ( ) == range. prefix . ip ( )
187- && prefix. prefix ( ) >= range. masklen_lower
188- && prefix. prefix ( ) <= range. masklen_upper
189- } )
184+ match match_sets. prefixes . get ( & ( value. clone ( ) , af) ) {
185+ Some ( set) => set. prefixes . iter ( ) . any ( |range| {
186+ prefix. ip ( ) == range. prefix . ip ( )
187+ && prefix. prefix ( ) >= range. masklen_lower
188+ && prefix. prefix ( ) <= range. masklen_upper
189+ } ) ,
190+ None => false ,
191+ }
190192 }
191193 // "match-neighbor-set"
192194 PolicyCondition :: MatchNeighborSet ( value) => {
@@ -195,13 +197,16 @@ fn process_stmt_condition(
195197 return true ;
196198 } ;
197199
198- let set = match_sets. neighbors . get ( value) . unwrap ( ) ;
199- set. addrs . contains ( remote_addr)
200+ match match_sets. neighbors . get ( value) {
201+ Some ( set) => set. addrs . contains ( remote_addr) ,
202+ None => false ,
203+ }
200204 }
201205 // "match-tag-set"
202206 PolicyCondition :: MatchTagSet ( value) => {
203- if let Some ( tag) = & rpinfo. tag {
204- let set = match_sets. tags . get ( value) . unwrap ( ) ;
207+ if let Some ( tag) = & rpinfo. tag
208+ && let Some ( set) = match_sets. tags . get ( value)
209+ {
205210 set. tags . contains ( tag)
206211 } else {
207212 false
0 commit comments