[Rt-commit] rt branch, 4.4/empty-order-uninitialized-warning, created. rt-4.4.2-87-ga51ae1d52

? sunnavy sunnavy at bestpractical.com
Tue Mar 6 16:52:23 EST 2018


The branch, 4.4/empty-order-uninitialized-warning has been created
        at  a51ae1d52ceda6f8c81c4cbb052c193e34e1986f (commit)

- Log -----------------------------------------------------------------
commit a51ae1d52ceda6f8c81c4cbb052c193e34e1986f
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 7 05:37:46 2018 +0800

    fix the uninitialized warning in case @Order is empty
    
    It's rare but allowed that @Order is empty while @OrderBy is not

diff --git a/share/html/Elements/CollectionAsTable/Header b/share/html/Elements/CollectionAsTable/Header
index 4a2576858..e82e66a48 100644
--- a/share/html/Elements/CollectionAsTable/Header
+++ b/share/html/Elements/CollectionAsTable/Header
@@ -138,7 +138,7 @@ foreach my $col ( @Format ) {
         $attr = ProcessColumnMapValue( $attr, Arguments => [ $col->{'attribute'} ], Escape => 0 );
 
         my $new_order = 'ASC';
-        $new_order = $Order[0] eq 'ASC'? 'DESC': 'ASC'
+        $new_order = ($Order[0] // '') eq 'ASC'? 'DESC': 'ASC'
             if $OrderBy[0] && ($OrderBy[0] eq $attr or "$attr|$OrderBy[0]" =~ /^(Created|id)\|(Created|id)$/);
 
         $m->out(

-----------------------------------------------------------------------


More information about the rt-commit mailing list