Fix NULL access for empty range insertions