--- uc_donation.module.orig	2009-03-17 15:35:41.000000000 +0100
+++ uc_donation.module	2009-03-19 22:11:03.000000000 +0100
@@ -116,7 +116,7 @@
 
     // Add spacer to regular products for amount column
     foreach (element_children($form['items']) as $item) {
-      if ($form['items'][$item]['module']['#value'] != 'uc_donation') {
+      if (isset($form['items'][$item]['module']) && $form['items'][$item]['module']['#value'] != 'uc_donation') {
         $form['items'][$item]['desc']['#cell_attributes']['colspan'] = '2';
       }
     }
@@ -141,8 +141,9 @@
 }
 
 function uc_donation_forms($form_id, $args) {
-  $product = $args[0];
-  if ($product->type == 'donation') {
+  $forms = array();
+  $product = isset($args[0]) && is_object($args[0]) ? $args[0] : NULL;
+  if (isset($product->type) && $product->type == 'donation') {
     $forms['uc_product_add_to_cart_form_'. $product->nid] = array('callback' => 'uc_product_add_to_cart_form');
     $forms['uc_catalog_buy_it_now_form_'. $product->nid] = array('callback' => 'uc_donation_buy_it_now_form');
   }
@@ -152,7 +153,7 @@
 function uc_donation_form(&$node) {
   $form = uc_product_form($node);
 
-  $form['#validate']['uc_product_validate'] = array();
+  $form['#validate'][] = 'uc_product_validate';
   return $form;
 }
 
@@ -301,7 +302,7 @@
     $node = node_load($nid);
     if ($node->type == 'donation') {
       $items = uc_cart_get_contents();
-      if (!empty($items)) {
+      if (!empty($items) && isset($data['attributes'])) {
         foreach ($items as $item) {
           if ($item->nid == $nid) {
             if ($data['attributes'] == $item->data['attributes']) {
