proc_mux: Fix crash when trying to optimize non-existant mux to shiftx
authorSylvain Munaut <tnt@246tNt.com>
Wed, 3 Apr 2019 12:50:12 +0000 (14:50 +0200)
committerSylvain Munaut <tnt@246tNt.com>
Wed, 3 Apr 2019 12:50:12 +0000 (14:50 +0200)
last_mux_cell can be NULL ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
passes/proc/proc_mux.cc

index 7d3d2340828fe4ba14af3fa5c54999595022f25d..bac2dc2cddcc6dd590afa5554dabe0d1991b8483 100644 (file)
@@ -361,7 +361,7 @@ RTLIL::SigSpec signal_to_mux_tree(RTLIL::Module *mod, SnippetSwCache &swcache, d
                }
 
                // Transform into a $shiftx where possible
-               if (shiftx && last_mux_cell->type == "$pmux") {
+               if (shiftx && last_mux_cell && last_mux_cell->type == "$pmux") {
                        // Create bit-blasted $shiftx-es that shifts by the address line used in the case statement
                        auto pmux_b_port = last_mux_cell->getPort("\\B");
                        auto pmux_y_port = last_mux_cell->getPort("\\Y");