[Koha-patches] [PATCH] Bug 11135 Check variable exists before splitting

Colin Campbell colin.campbell at ptfs-europe.com
Thu Oct 24 18:09:55 CEST 2013


calling split on an undefined var generates warning to
the log. Lets check it exists before processing it
---
 admin/preferences.pl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/admin/preferences.pl b/admin/preferences.pl
index 8636afe..9a2c8ca 100755
--- a/admin/preferences.pl
+++ b/admin/preferences.pl
@@ -121,7 +121,10 @@ sub TransformPrefsToHTML {
     my $tab = $data->{ $title };
     $tab = { '' => $tab } if ( ref( $tab ) eq 'ARRAY' );
 
-    my @override_syspref_names = split( /,/, $ENV{"OVERRIDE_SYSPREF_NAMES"} );
+    my @override_syspref_names;
+    if ( $ENV{OVERRIDE_SYSPREF_NAMES} ) {
+        @override_syspref_names = split /,/, $ENV{OVERRIDE_SYSPREF_NAMES};
+    }
 
     foreach my $group ( sort keys %$tab ) {
         if ( $group ) {
-- 
1.8.3.1



More information about the Koha-patches mailing list