#516104 by nonzero: Slightly shorter IF statement for file download access check.
authorNathan Haug
Tue, 20 Oct 2009 17:46:22 +0000 (17:46 +0000)
committerNathan Haug
Tue, 20 Oct 2009 17:46:22 +0000 (17:46 +0000)
filefield.module

index 2caafb5..15f7b6a 100644 (file)
@@ -180,8 +180,7 @@ function filefield_file_download($file) {
       if (isset($nodes[$content['nid']])) {
         continue; // Don't check the same node twice.
       }
-      $node = node_load($content['nid']);
-      if ($denied == FALSE && node_access('view', $node) == FALSE) {
+      if ($denied == FALSE && ($node = node_load($content['nid'])) && node_access('view', $node) == FALSE) {
         // You don't have permission to view the node this file is attached to.
         $denied = TRUE;
       }