Changeset 507


Ignore:
Timestamp:
11/10/08 04:10:29 (3 years ago)
Author:
SvenDowideit
Message:

Item124: undefined ICONTOPIC causes crash

Location:
branches/Release04x02/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/Release04x02/lib/TWiki.pm

    r506 r507  
    12381238 
    12391239    my $iconTopic = $this->{prefs}->getPreferencesValue('ICONTOPIC'); 
    1240     my ( $web, $topic ) = 
    1241       $this->normalizeWebTopicName( $this->{webName}, $iconTopic ); 
    1242     $iconName =~ s/^.*\.(.*?)$/$1/; 
    1243     return $this->getPubUrl( $absolute, $web, $topic, $iconName . '.gif' ); 
     1240    if (defined($iconTopic)) { 
     1241        my ( $web, $topic ) = 
     1242            $this->normalizeWebTopicName( $this->{webName}, $iconTopic ); 
     1243        $iconName =~ s/^.*\.(.*?)$/$1/; 
     1244        return $this->getPubUrl( $absolute, $web, $topic, $iconName . '.gif' ); 
     1245    } ele { 
     1246        return ''; 
     1247    } 
    12441248} 
    12451249 
     
    12611265    unless ( $this->{_ICONMAP} ) { 
    12621266        my $iconTopic = $this->{prefs}->getPreferencesValue('ICONTOPIC'); 
    1263         my ( $web, $topic ) = 
    1264           $this->normalizeWebTopicName( $this->{webName}, $iconTopic ); 
    1265         local $/ = undef; 
    1266         try { 
    1267             my $icons = 
    1268               $this->{store} 
    1269               ->getAttachmentStream( undef, $web, $topic, '_filetypes.txt' ); 
    1270             %{ $this->{_ICONMAP} } = split( /\s+/, <$icons> ); 
    1271             close($icons); 
    1272         } 
    1273         catch Error::Simple with { 
    1274             %{ $this->{_ICONMAP} } = (); 
    1275         }; 
     1267        if (defined($iconTopic)) { 
     1268            my ( $web, $topic ) = 
     1269              $this->normalizeWebTopicName( $this->{webName}, $iconTopic ); 
     1270            local $/ = undef; 
     1271            try { 
     1272                my $icons = 
     1273                  $this->{store} 
     1274                  ->getAttachmentStream( undef, $web, $topic, '_filetypes.txt' ); 
     1275                %{ $this->{_ICONMAP} } = split( /\s+/, <$icons> ); 
     1276                close($icons); 
     1277            } 
     1278            catch Error::Simple with { 
     1279                %{ $this->{_ICONMAP} } = (); 
     1280            }; 
     1281        } else { 
     1282            return $default || $fileName; 
     1283        } 
    12761284    } 
    12771285 
  • branches/Release04x02/lib/TWiki/Attach.pm

    r21 r507  
    195195    elsif ( $attr eq 'ICON' ) { 
    196196        my $picked = $this->{session}->mapToIconFileName($file); 
     197        if (!defined($picked) || ($picked eq '')) { 
     198            return ''; 
     199        } 
    197200        my $url = $this->{session}->getIconUrl( 0, $picked ); 
    198201        return CGI::img( 
Note: See TracChangeset for help on using the changeset viewer.