Hard link cutter

Message ID 46003DBD.6070804@gmx.de
State New
Headers

Commit Message

Udo Richter March 20, 2007, 8:02 p.m. UTC
  Andreas Brachold wrote:
> i like your patch, but its work only on some recordings.
> Its failed with a segmentation fault, on cutting.
> The only differ are unbalanced marks (out missed)

Confirmed, the patch doesn't handle the case that the last mark is a 
cut-in mark, not a cut-out. In that case 'Mark' will be NULL, causing a 
segfault. The attached (untested) patch should do the trick.

Cheers,

Udo
  

Patch

Index: cutter.c
===================================================================
--- cutter.c	(revision 895)
+++ cutter.c	(working copy)
@@ -167,8 +167,9 @@ 
                  uchar MarkFileNumber;
                  int MarkFileOffset;
                  // Get file number of next cut mark
-                 if (fromIndex->Get(Mark->position, &MarkFileNumber, &MarkFileOffset)
-                     && (MarkFileNumber != CurrentFileNumber)) {
+                 if (!Mark 
+                     || fromIndex->Get(Mark->position, &MarkFileNumber, &MarkFileOffset)
+                        && (MarkFileNumber != CurrentFileNumber)) {
                     // The current source file will be copied completely.
                     // Start new output file unless we did that already
                     if (FileSize != 0) {