Ignore:
Timestamp:
Jul 7, 2010, 10:50:18 PM (12 years ago)
Author:
charles
Message:

(trunk T) #3404 "crash when creating a .torrent containing empty content" -- fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/makemeta-ui.c

    r10340 r10970  
    1818#include <libtransmission/transmission.h>
    1919#include <libtransmission/makemeta.h>
     20#include <libtransmission/utils.h> /* tr_formatter_mem_B() */
    2021
    2122#include "conf.h"
     
    6869    GtkDialog * d = GTK_DIALOG( ui->progress_dialog );
    6970    GtkProgressBar * p = GTK_PROGRESS_BAR( ui->progress_bar );
    70     const double fraction = (double)b->pieceIndex / b->pieceCount;
    71         char * base = g_path_get_basename( b->top );
     71    const double fraction = b->pieceCount ? ((double)b->pieceIndex / b->pieceCount) : 0;
     72    char * base = g_path_get_basename( b->top );
    7273
    7374    /* progress label */
     
    301302                                buf, builder->fileCount );
    302303        g_string_append( gstr, "; " );
    303         tr_strlsize( buf, builder->pieceSize, sizeof( buf ) );
     304 
     305        tr_formatter_mem_B( buf, builder->pieceSize, sizeof( buf ) );
    304306        g_string_append_printf( gstr, ngettext( "%1$'d Piece @ %2$s",
    305307                                                "%1$'d Pieces @ %2$s",
Note: See TracChangeset for help on using the changeset viewer.