if (!NILP (absolute))
start = BEG_BYTE;
- /* Check that POSITION is in the accessible range of the buffer. */
- if (pos < BEGV || pos > ZV)
+ /* Check that POSITION is in the accessible range of the buffer, or,
+ if we're reporting absolute positions, in the buffer. */
+ if (NILP (absolute) && (pos < BEGV || pos > ZV))
args_out_of_range_3 (make_int (pos), make_int (BEGV), make_int (ZV));
+ else if (!NILP (absolute) && (pos < 1 || pos > Z))
+ args_out_of_range_3 (make_int (pos), make_int (1), make_int (Z));
return make_int (count_lines (start, CHAR_TO_BYTE (pos)) + 1);
}