Trying to get a property of a non-object in 'mymodule_node_access()' In a custom module, I try to make this code work :

function mymodule_node_access($node, $op, $account) {
  if ($node-&gt;type = 'devis' and $op = 'view') {
    $field_language = field_language('node', $node, 'field_project');
    $project_node = node_load($node-&gt;fields-&gt;field_project[$field_language][0]['value']);
    if ($project_node-&gt;uid == $account-&gt;uid) {
      return NODE_ACCESS_IGNORE;
    }   
    else {
      return NODE_ACCESS_DENIED;
    }
  } 
}


I get the following notice:


  Trying to get a property of a non-object in mymodule_node_access()


I don't know where the problem is.
$node in hook_node_access() can be either a string for the content-type or a node object.
I had to test if it was a string or an object.

if (is_string($node)) { 
  return NODE_ACCESS_IGNORE;
}
else {
  // ...
}