groups/patches/0010-commons-activity-strea...

23 lines
1.4 KiB
Diff

diff --git a/modules/commons/commons_activity_streams/commons_activity_streams.module.orig b/modules/commons/commons_activity_streams/commons_activity_streams.module
index 854b4f3..30b0f92 100644
--- a/modules/commons/commons_activity_streams/commons_activity_streams.module.orig
+++ b/modules/commons/commons_activity_streams/commons_activity_streams.module
@@ -98,7 +98,7 @@ function commons_activity_streams_message_access_alter(&$access, $context) {
$message = $context['entity'];
// Verify view access to nodes referenced in the message.
- if (isset($message->field_target_nodes)) {
+ if ((isset($message->field_target_nodes)) && (!empty($message->field_target_nodes))) {
foreach ($message->field_target_nodes[LANGUAGE_NONE] as $key => $value) {
$node = node_load($value['target_id']);
if (!node_access('view', $node, $context['account'])) {
@@ -110,7 +110,7 @@ function commons_activity_streams_message_access_alter(&$access, $context) {
}
}
// Verify view access to comments referenced in the message.
- if (isset($message->field_target_comments)) {
+ if ((isset($message->field_target_comments)) && (!empty($message->field_target_comments))) {
foreach ($message->field_target_comments[LANGUAGE_NONE] as $key => $value) {
$comment = comment_load($value['target_id']);
if (!entity_access('view', 'comment', $comment, $context['account'])) {