From: miker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Sat, 27 Mar 2010 20:06:30 +0000 (+0000)
Subject: make empty queries safe
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=201fecc73545605c19636d1c71c1adb99e43f768;p=evergreen%2Fmasslnc.git

make empty queries safe

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16024 dcc99617-32d9-48b4-a31d-7c20da2025e4
---

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm
index 390cc264bc..cc4dc54255 100755
--- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm
@@ -503,7 +503,9 @@ sub decompose {
 
     my $last_type = '';
     while (!$remainder) {
-        if (/$group_end_re/) { # end of an explicit group
+        if (/^\s*$/) { # end of an explicit group
+            last;
+        } elsif (/$group_end_re/) { # end of an explicit group
             warn "Encountered explicit group end\n" if $self->debug;
 
             $_ = $';
@@ -689,7 +691,7 @@ sub QueryParser {
 sub new {
     my $pkg = shift;
     $pkg = ref($pkg) || $pkg;
-    my %args = (joiner => '&', @_);
+    my %args = (query => [], joiner => '&', @_);
 
     return bless \%args => $pkg;
 }