Silence uninit var warnings from query normalizer
authorDan Scott <dscott@laurentian.ca>
Fri, 21 Jun 2013 03:11:20 +0000 (23:11 -0400)
committerBill Erickson <berick@esilibrary.com>
Fri, 21 Jun 2013 13:33:46 +0000 (09:33 -0400)
$field_info can return undef from the search for a matching ID from the
list of normalizers, which in turn generates several uninit var warnings
when attempts are made to access members of the undef variable. We saw
6700 occurrences of these warnings during a typical day of operations.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm

index 4fcbe5e..c41f163 100644 (file)
@@ -415,6 +415,7 @@ sub initialize_query_normalizers {
 
     for my $cmfinm ( @$tree ) {
         my $field_info = $self->search_field_class_by_id( $cmfinm->field );
+        next unless $field_info;
         __PACKAGE__->add_query_normalizer( $field_info->{classname}, $field_info->{field}, $cmfinm->norm->func, OpenSRF::Utils::JSON->JSON2perl($cmfinm->params) );
     }
 }