CMB2 Post Search Field displays/repeats initial post if left empty

Okay, I think that I’ve sorted this myself by looking again at the isset check. Instead of

if ( ! empty( $connections ) ) {

I’ve put:

if ( isset( $connections[0]['gwl_collection_item_name_connection_related_post'] ) ) {

and so far this seems to be working. (I think the issue arises because the CMB2 group saves an empty array in the meta_value column, so $connections isn’t empty/ is set, and because the array doesn’t have a value for the post id, it then pulls in the id of the initial post – but I’m not sure if my understanding of this is correct)