Changeset 8764


Ignore:
Timestamp:
Jun 30, 2009, 10:27:22 PM (13 years ago)
Author:
charles
Message:

(trunk gtk,qt) fix possible division by zero in the torrent properties dialog

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r8756 r8764  
    792792        else {
    793793            char unver[64], total[64];
    794             const double ratio = ( 100.0 * ( haveValid + haveUnchecked ) )  / leftUntilDone;
     794            const double ratio = 100.0 * ( leftUntilDone ? ( haveValid + haveUnchecked ) / leftUntilDone : 1 );
    795795            tr_strlsize( total, haveUnchecked + haveValid, sizeof( total ) );
    796796            tr_strlsize( unver, haveUnchecked,             sizeof( unver ) );
  • trunk/qt/details.cc

    r8756 r8764  
    268268        string = none;
    269269    else {
    270         QString pct = locale.toString( 100.0*((sizeWhenDone-leftUntilDone)/sizeWhenDone), 'f', 2 );
     270        const double d = 100.0 * ( sizeWhenDone ? ( sizeWhenDone - leftUntilDone ) / sizeWhenDone : 1 );
     271        QString pct = locale.toString( d, 'f', 2 );
    271272        if( !haveUnverified )
    272273            string = tr( "%1 (%2%)" )
Note: See TracChangeset for help on using the changeset viewer.