I am getting the following error while running cron:

Fatal error: Call to a member function setMultiValue() on a non-object in /hccorp/inst/master/drupal/sites/all/modules/nodequeue/nodequeue.module on line 366

This is happening because the same hook in a previous module is setting document to null to prevent a search entry being created for a document.

I'm sure there's an argument for this being the fault of the other module but a pretty trivial change to nodequeue will support this behaviour without breaking anything else. Simply do nothing if $document is null.

Patch to follow...

CommentFileSizeAuthor
#1 nodequeue-710234.patch723 bytesjamespharaoh

Comments

jamespharaoh’s picture

StatusFileSize
new723 bytes
ezra-g’s picture

Status: Active » Fixed

I made a minor change to use empty() and to make the conditional comply with http://drupal.org/coding-standards . Committed. Thanks! Also, please remember to set your patch issues to "needs review" -- I missed this one :).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

kenorb’s picture

Empty() doesn't work perfectly in some cases in Drupal 6.x.
See: #1777622: Simpletest: Fatal error: Call to undefined method stdClass::setMultiValue() in nodequeue.module on line 422

This could be a better approach:

--- nodequeue.module	(revision 6440)
+++ nodequeue.module	(working copy)
@@ -407,7 +407,7 @@
  * Implementation of hook_apachesolr_update_index().
  */
 function nodequeue_apachesolr_update_index(&$document, $node) {
-  if (empty($document)) {
+  if (!count((array)$document)) { // ignore empty document objects
     return;
   }
PHP > 5.0.0
Objects with no properties are no longer considered empty.

http://php.net/empty