--- uc_attribute_stock_filter.module.orig	2009-08-13 15:54:21.000000000 +0200
+++ uc_attribute_stock_filter.module	2009-08-13 15:57:21.000000000 +0200
@@ -97,17 +97,18 @@
       }
 
       // Traverse through $form and unset any options that are not on the list
-      foreach ($form['attributes'] as $key => $attribute) {
-        if (is_numeric($key)) {
-          foreach ($form['attributes'][$key]['#options'] as $opt_key => $option) {
-            // Make sure it's numeric, don't kill the "Select..." option
-            if (is_numeric($opt_key) && !in_array($opt_key, $available)) {
-              unset($form['attributes'][$key]['#options'][$opt_key]);
-            }
-          }
-        }
-      }
-    }
-
+      if(is_array($form['attributes'])){
+				foreach ($form['attributes'] as $key => $attribute) {
+					if (is_numeric($key)) {
+						foreach ($form['attributes'][$key]['#options'] as $opt_key => $option) {
+							// Make sure it's numeric, don't kill the "Select..." option
+							if (is_numeric($opt_key) && !in_array($opt_key, $available)) {
+								unset($form['attributes'][$key]['#options'][$opt_key]);
+							}
+						}
+					}
+				}
+			}
+		}
   }
 }
