Is there any chance that `get_selected_cell()` returns `null`? If so, probably default to 'code' in that case.