From 9b3137df29c16f2ae2860ec143c0eafb14b6d30c Mon Sep 17 00:00:00 2001
From: Marco Villegas <marvil07@gmail.com>
Date: Fri, 17 Dec 2010 13:55:29 -0500
Subject: [PATCH] bug #1001480 by marvil07 | sdboyer: Prevent empty values to be attached to the controller query.

This happens trying to load a condition like repository data = array().
---
 includes/controllers.inc |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git includes/controllers.inc includes/controllers.inc
index a8fed9e..3053fb6 100644
--- includes/controllers.inc
+++ includes/controllers.inc
@@ -224,7 +224,12 @@ abstract class VersioncontrolEntityController {
     // If provided, attach generic conditions.
     if ($conditions) {
       foreach ($conditions as $field => $value) {
-        $this->attachCondition($query, $field, $value);
+        if (!empty($value)) {
+          $this->attachCondition($query, $field, $value);
+        }
+        else {
+          throw new Exception(t('Attempted to attach an empty condition on field @field with the controller @controller.', array('@field' => $field, '@controller' => get_class($this))), E_ERROR);
+        }
       }
     }
   }
-- 
1.7.2.3

