scribu/wp-posts-to-posts — pull request #384 by dimadin (2013-08-06 20:01:29+00:00)
Title: Validate that connection exists before saving meta

If connection doesn't exist, user will get warnings *Invalid argument supplied for foreach()* in `P2P_Box_Factory::save_post()` and `scbForms::update_meta()`.

I reproduced this while creating duplicates of posts with connections using plugin Multilingual Press, [on](https://github.com/inpsyde/multilingual-press/blob/0fa71e21f00098bb642fb7e5b56fe7c487cc4b1f/multilingual-press.php#L622) `save_post` it uses `switch_to_blog()` and then `wp_insert_post()` to create duplicate and since `save_post` is called then, `P2P_Box_Factory::save_post()` will be fired which will use connection that doesn't exists or is wrong.