Issue with the features Module I am experiencing an error when creating some nodes of a particular content type on my site: It triggers a 500 error when users try to save the node. When I look into the log error this is the message displayed:


  Notice: Trying to get property of non-object in _MO_events_is_event_page() (line 461 of /var/www/Server_Name/htdocs/MO/sites/all/modules/features/MO_events/MO_events.module).


Does anyone have any ideas as to what may be the cause? 

Here is the Code on line 461

function _MO_events_is_event_page() {
  $is_event = &amp;drupal_static(__FUNCTION__);

  if (NULL === $is_event) {
    $menu_item = menu_get_item();
// If the current menu router is a node of type event or virtual_conference we're on an event page

     //Line 461:  
    $is_event = (TRUE === isset($menu_item['page_arguments'][0]) &amp;&amp; TRUE === isset($menu_item['page_arguments'][0]-&gt;type) &amp;&amp; ('event' == $menu_item['page_arguments'][0]-&gt;type) || 'virtual_conference' == $menu_item['page_arguments'][0]-&gt;type);
          }

          return $is_event;
        }
That error means that $menu_item['page_arguments'][0] isn't an object in the context in which that code is run. It's probably happening during a redirect where the page isn't node/123, and so there's no node object available.

You can fix it by adding a bit of error checking (I've taken the liberty of using menu_get_object() instead of menu_get_item(), it's a more standard way of getting the current node object):

function _MO_events_is_event_page() {
  $is_event = &amp;drupal_static(__FUNCTION__);

  if ($is_event === NULL &amp;&amp; $node = menu_get_object()) {
    $is_event = $node-&gt;type == 'event' || $node-&gt;type == 'virtual_conference';
  }

  return (bool) $is_event;
}