Index: flag.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flag/Attic/flag.module,v
retrieving revision 1.11.2.72.2.31
diff -u -p -r1.11.2.72.2.31 flag.module
--- flag.module	8 Jan 2010 05:17:57 -0000	1.11.2.72.2.31
+++ flag.module	15 Mar 2010 14:11:31 -0000
@@ -726,8 +726,7 @@ function flag_flag($action, $flag, $cont
 function flag_flag_access($flag, $content_id, $action, $account) {
   // Restrict access by authorship. It's important that TRUE is never returned
   // here, otherwise we'd grant permission even if other modules denied access.
-  if ($flag->content_type == 'node') {
-    $node = node_load($content_id);
+  if ($flag->content_type == 'node' && $node = node_load($content_id)) {
     if ($flag->access_author == 'own' && $node->uid != $account->uid) {
       return FALSE;
     }
@@ -738,7 +737,6 @@ function flag_flag_access($flag, $conten
 
   // Restrict access by comment authorship.
   if ($flag->content_type == 'comment') {
-    $comment = _comment_load($content_id);
     $node = node_load($comment->nid);
     if ($flag->access_author == 'node_own' && $node->uid != $account->uid) {
       return FALSE;
@@ -746,11 +744,13 @@ function flag_flag_access($flag, $conten
     elseif ($flag->access_author == 'node_others' && $node->uid == $account->uid) {
       return FALSE;
     }
-    elseif ($flag->access_author == 'comment_own' && $comment->uid != $account->uid) {
-      return FALSE;
-    }
-    elseif ($flag->access_author == 'comment_others' && $comment->uid == $account->uid) {
-      return FALSE;
+    elseif ($comment = _comment_load($content_id)) {
+      if ($flag->access_author == 'comment_own' && $comment->uid != $account->uid) {
+        return FALSE;
+      }
+      elseif ($flag->access_author == 'comment_others' && $comment->uid == $account->uid) {
+        return FALSE;
+      }
     }
   }
 }
