Author: kitone
Date: Thu Jan  8 19:19:32 2015
New Revision: 881

URL: http://svn.gna.org/viewcvs/subtitleeditor?rev=881&view=rev
Log:
Fix bug #23151 : Using best fit subtitles on zero-length subtitles crashes 
subtitleeditor

Modified:
    trunk/ChangeLog
    trunk/plugins/actions/bestfit/bestfit.cc

Modified: trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/subtitleeditor/trunk/ChangeLog?rev=881&r1=880&r2=881&view=diff
==============================================================================
--- trunk/ChangeLog     (original)
+++ trunk/ChangeLog     Thu Jan  8 19:19:32 2015
@@ -1,3 +1,8 @@
+2015-01-08  kitone  <[email protected]>
+
+       * plugins/actions/bestfit/bestfit.cc:
+       Fix bug #23151 : Using best fit subtitles on zero-length subtitles 
crashes subtitleeditor
+
 2015-01-05  kitone  <[email protected]>
 
        * src/we/waveformeditor.cc:

Modified: trunk/plugins/actions/bestfit/bestfit.cc
URL: 
http://svn.gna.org/viewcvs/subtitleeditor/trunk/plugins/actions/bestfit/bestfit.cc?rev=881&r1=880&r2=881&view=diff
==============================================================================
--- trunk/plugins/actions/bestfit/bestfit.cc    (original)
+++ trunk/plugins/actions/bestfit/bestfit.cc    Thu Jan  8 19:19:32 2015
@@ -198,6 +198,11 @@
                        totalchars += utility::get_text_length_for_timing( 
subtitles[i].get_text() );
                }
 
+               // Avoid divide by zero
+               // Fix bug #23151 : Using best fit subtitles on zero-length 
subtitles crashes subtitleeditor
+               if(totalchars == 0)
+                       return;
+
                // Distribute available time between selected subtitles in 
proportion to the length of their text
                long subchars = 0;
                long prevchars = 0;


_______________________________________________
Subtitleeditor-commits mailing list
[email protected]
https://mail.gna.org/listinfo/subtitleeditor-commits

Reply via email to