sd: fix STL assertion "dereference past-the-end iterator"

(regression from 967a386bccb15b99915a1e878e42450fbe9a2d0e)

Change-Id: I9408170eb155f433922e5b3887059078a141d78a