Fix #6441.

Add check for the line number to be positive.