Fix code_to_line when called with empty code

Previously, it was referring to `line` before it was assigned. Noticed when testing the R kernel.