Delete 'links' only if it is present

This was uncovered during some mock testing where 'links' was not
always present.

Change-Id: I72c6ce9414394b1999c2925665c5bd74713d2d7f
Merge "Delete 'links' only if it is present"