Fix regression causing toolchange_gcode to crash Slic3r. Includes regression test. #1545