File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -247,8 +247,13 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
247247 . expect ( "compiler produces sane output" ) ;
248248 leaf_compilations. push ( ( OrdF64 ( prob) , compilation) ) ;
249249 }
250- let tap_tree = with_huffman_tree :: < Pk > ( leaf_compilations) . unwrap ( ) ;
251- Some ( tap_tree)
250+ if !leaf_compilations. is_empty ( ) {
251+ let tap_tree = with_huffman_tree :: < Pk > ( leaf_compilations) . unwrap ( ) ;
252+ Some ( tap_tree)
253+ } else {
254+ // no policies remaining once the extracted key is skipped
255+ None
256+ }
252257 }
253258 } ,
254259 )
@@ -303,8 +308,14 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
303308 )
304309 } )
305310 . collect ( ) ;
306- let tap_tree = with_huffman_tree :: < Pk > ( leaf_compilations) . unwrap ( ) ;
307- Some ( tap_tree)
311+
312+ if !leaf_compilations. is_empty ( ) {
313+ let tap_tree = with_huffman_tree :: < Pk > ( leaf_compilations) . unwrap ( ) ;
314+ Some ( tap_tree)
315+ } else {
316+ // no policies remaining once the extracted key is skipped
317+ None
318+ }
308319 }
309320 } ,
310321 ) ?;
You can’t perform that action at this time.
0 commit comments