I have implemented hook\_node access so that two users cannot view each other's posts if they do not have the right permission (I implemented the permission in hook\_permission). I use a comparison with $node->uid as follows:

```
 function mymodule_node_access( $node, $op, $account)
 {
   global $user;                                                                                                                                                       
   $type = is_string($node) ? $node : $node->type;

   switch($type)
   {
    case "myCustomType":

      if ( ($user->uid != $node->uid) && !user_access("view other's posts"))
       {
              return NODE_ACCESS_DENY;

       }
       break;

   }

}

```

Everything works fine but I do get the following warning:

> 
> Notice: Trying to get property of non-object in `mymodule_node_access()`. 
> 
> 
> 

This is caused by this: $node->uid. Drupal complains that $node is a not a stdobject (it seems to actually be string containing the node's type). Yet the code still works which I do not understand why. 

What is the proper way to access the node's uid from hook\_node\_access?