This should be `if (lineNumber !== null)`. Otherwise you won't be able to set the cursor at the first line.