File tree 1 file changed +15
-4
lines changed
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> {
247
247
. expect ( "compiler produces sane output" ) ;
248
248
leaf_compilations. push ( ( OrdF64 ( prob) , compilation) ) ;
249
249
}
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
+ }
252
257
}
253
258
} ,
254
259
)
@@ -303,8 +308,14 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
303
308
)
304
309
} )
305
310
. 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
+ }
308
319
}
309
320
} ,
310
321
) ?;
You can’t perform that action at this time.
0 commit comments