With the new file_entity_access function, we may run in a new issue, as reported in http://drupal.org/node/1869206#comment-6861674 . It may happen, if there is a media referenced, which no longer exists.

Comments

I run exactly the same issue, I temporary resolved it by replacing:

function media_gallery_filter_media_access($media_files, $operation) {
  $media_accessable = array();
  foreach ($media_files as $key => $media) {
    if (file_entity_access($operation, (object)$media)) {
      $media_accessable[] = $media;
    }
  }
  return $media_accessable;
}

in media_gallery.module, by
function media_gallery_filter_media_access($media_files, $operation) {
  $media_accessable = array();
  foreach ($media_files as $key => $media) {
    if (isset($media->fid) && file_entity_access($operation, (object)$media)) {
      $media_accessable[] = $media;
    }
  }
  return $media_accessable;
}

Of course, the file is not displayed anymore...