osd/ReplicatedPG: avoid dereferencing iterator at end()

The preceding loop could terminate with p == snapset.clones.end(), which we
assign to dnewest.  We can't dereference the iterator in that case.

For example:

 start_flush ffe627f3/foo/a/test-rados-api-plana05-22080-18/83 v430'42 uv130
blocking
 snapset b=[b,a]:[a,b]+head
start_flush no older clones

prev_snapc will be 0, oi.snaps will be [a], p will end up at end(), get 
assigned to dnewest, and we'll dereference.  It's only sometime harmful 
though because we may still take the right (else) branch...

Fixes: #9294 Signed-off-by: Sage Weil <sage@redhat.com>