Permalink
Browse files

Merge pull request #984 from GlotPress/983-test-for-empty-notes-list

983: Make sure we have notes to delete before doing so.
  • Loading branch information...
toolstack committed Jan 3, 2019
2 parents 8733533 + 8adf71b commit f894e70266508994322702dae6053b6b2f9bbf18
Showing with 5 additions and 1 deletion.
  1. +5 −1 gp-includes/things/original.php
@@ -517,7 +517,11 @@ public function after_delete() {
do_action( 'gp_original_deleted', $this );
$note_id = GP::$notes->get_by_translation_id( $this->id );
GP::$notes->delete_all( array( 'id' => $note_id ) );
// Make sure we have some note id's to delete before trying to delete them.
if ( ! is_array( $note_id ) ) {
GP::$notes->delete_all( array( 'id' => $note_id ) );
}
return true;
}

0 comments on commit f894e70

Please sign in to comment.