diff --git a/uc_cart/uc_cart.module b/uc_cart/uc_cart.module
index 0a78f50..bd76368 100644
--- a/uc_cart/uc_cart.module
+++ b/uc_cart/uc_cart.module
@@ -1292,9 +1292,11 @@ function uc_cart_get_contents($cid = NULL, $action = NULL) {
         $items[$cid] = entity_load('uc_cart_item', array_keys($result['uc_cart_item']), NULL, TRUE);
         // Create a bare order and attach it to each item as context.
         $order = new UcOrder();
-        $order->uid = $cid;
-        if ($account = user_load($cid)) {
-          $order->primary_email = $account->mail;
+        if (ctype_digit($cid)) {
+          $order->uid = $cid;
+          if ($account = user_load($order->uid)) {
+            $order->primary_email = $account->mail;
+          }
         }
         $order->order_status = uc_order_state_default('in_checkout');
         $order->created = REQUEST_TIME;
