Changeset 2043

Show
Ignore:
Timestamp:
04/23/08 00:52:23 (22 months ago)
Author:
auno
Message:

Set zero for some inconsistent comment/ping count just in case. BugzID:79433

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-36/lib/MT/Entry.pm

    r1920 r2043  
    364364        my $entry   = MT::Entry->load( $comment->entry_id ) 
    365365            or return; 
    366         if ($comment->visible) { 
    367             $entry->comment_count( $entry->comment_count - 1 ); 
     366        if ( $comment->visible ) { 
     367            my $count = $entry->comment_count > 0 ? $entry->comment_count - 1 : 0; 
     368            $entry->comment_count($count); 
    368369            $entry->save; 
    369370        } 
     
    414415                my $entry = MT::Entry->load( $tb->entry_id ) 
    415416                    or return; 
    416                 $entry->ping_count( $entry->ping_count - 1 ); 
     417                my $count = $entry->ping_count > 0 ? $entry->ping_count - 1 : 0; 
     418                $entry->ping_count($count); 
    417419                $entry->save; 
    418420            }