File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -2847,17 +2847,17 @@ impl Program {
28472847 }
28482848
28492849 pub fn unregister_block ( & mut self , name : String ) {
2850- let block_ix = self . block_info . block_names . remove ( & name) . unwrap ( ) ;
2851- let block = self . block_info . blocks . remove ( block_ix) ;
2852-
2853- for ( pipe_ix , pipe ) in block. pipes . iter ( ) . enumerate ( ) {
2854- for shape in block . shapes [ pipe_ix ] . iter ( ) {
2855- match shape {
2856- & PipeShape :: Scan ( e, a, v) => {
2857- self . block_info . pipe_lookup . get_mut ( & ( e , a , v ) ) . unwrap ( ) . remove_item ( pipe ) ;
2858- } ,
2859- & PipeShape :: Intermediate ( id) => {
2860- self . block_info . intermediate_pipe_lookup . get_mut ( & id ) . unwrap ( ) . remove_item ( pipe ) ;
2850+ if let Some ( block_ix) = self . block_info . block_names . remove ( & name) {
2851+ let block = self . block_info . blocks . remove ( block_ix) ;
2852+ for ( pipe_ix , pipe ) in block . pipes . iter ( ) . enumerate ( ) {
2853+ for shape in block. shapes [ pipe_ix ] . iter ( ) {
2854+ match shape {
2855+ & PipeShape :: Scan ( e , a , v ) => {
2856+ self . block_info . pipe_lookup . get_mut ( & ( e, a, v) ) . unwrap ( ) . remove_item ( pipe ) ;
2857+ } ,
2858+ & PipeShape :: Intermediate ( id ) => {
2859+ self . block_info . intermediate_pipe_lookup . get_mut ( & id) . unwrap ( ) . remove_item ( pipe ) ;
2860+ }
28612861 }
28622862 }
28632863 }
You can’t perform that action at this time.
0 commit comments