BUGFIX: line.erase() threw exception with illegal line end
Found by test case (molecuilder test 3), just do it the more complicated way.